Do not distribute backend source, export everything to commonjs

This commit is contained in:
Alice Gaudon 2021-11-20 15:30:02 +01:00
parent 5869ba3ee3
commit a753122290
8 changed files with 17 additions and 18 deletions

View File

@ -1,4 +1,4 @@
export default {
module.exports = {
globals: {
'ts-jest': {
tsconfig: 'tsconfig.test.json',

View File

@ -11,7 +11,6 @@
"access": "public"
},
"main": "dist/main.js",
"type": "module",
"types": "dist/index.d.ts",
"scripts": {
"test": "jest --verbose --runInBand",

View File

@ -1,7 +1,7 @@
import fs from "fs";
import path from "path";
const fs = require('fs');
const path = require('path');
export function copyRecursively(file, destination) {
function copyRecursively(file, destination) {
const target = path.join(destination, path.basename(file));
if (fs.statSync(file).isDirectory()) {
console.log('mkdir', target);
@ -16,3 +16,7 @@ export function copyRecursively(file, destination) {
fs.copyFileSync(file, target);
}
}
module.exports = {
copyRecursively,
};

View File

@ -1,4 +1,4 @@
import fs from "fs";
const fs = require('fs');
[
'intermediates',

View File

@ -1,6 +1,6 @@
import fs from "fs";
import path from "path";
import {copyRecursively} from "./_functions.js";
const fs = require('fs');
const path = require('path');
const {copyRecursively} = require('./_functions.js');
[

View File

@ -1,6 +1,5 @@
import fs from "fs";
import path from "path";
import {copyRecursively} from "./_functions.js";
const fs = require('fs');
const path = require('path');
// These folders must exist for nodemon not to loop indefinitely.
[
@ -18,10 +17,5 @@ if (!fs.existsSync(symlink)) {
fs.symlinkSync(path.resolve('dist/common'), symlink);
}
// Copy all source files
fs.readdirSync('src').forEach(file => {
copyRecursively(path.join('src', file), 'dist');
});
// Copy package.json
fs.copyFileSync('package.json', 'dist/package.json');

View File

@ -20,7 +20,7 @@
});
setRoutes(%routes%);
setPublicUrl(%publicUrl%);
setPublicUrl(`%publicUrl%`);
new View({
hydrate: true,

View File

@ -3,6 +3,8 @@
"compilerOptions": {
"composite": true,
"module": "CommonJS",
"baseUrl": "../dist",
"rootDir": "./",
"sourceRoot": "./",