@digigov/cli-build 2.0.0-13876dba → 2.0.0-16da9467
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.cjs +1 -0
- package/.rush/temp/shrinkwrap-deps.json +413 -32
- package/build.js +21 -21
- package/common.js +3 -3
- package/copy-files.js +43 -41
- package/eslint.config.js +3 -0
- package/generate-registry.js +23 -23
- package/index.js +40 -40
- package/package.json +12 -25
- package/tsconfig.json +3 -7
- package/babel.common.cjs +0 -119
- package/babel.config.cjs +0 -1
package/common.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
3
|
|
|
4
|
-
const POSSIBLE_TS_CONFIGS = [
|
|
4
|
+
const POSSIBLE_TS_CONFIGS = ['tsconfig.production.json', 'tsconfig.json'];
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Get the tsconfig path for the given project
|
package/copy-files.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { logger, resolveProject } from
|
|
2
|
-
import fs from
|
|
3
|
-
import path from
|
|
4
|
-
import glob from
|
|
1
|
+
import { logger, resolveProject } from '@digigov/cli/lib';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import glob from 'globby';
|
|
5
5
|
|
|
6
6
|
const packagePath = process.cwd();
|
|
7
7
|
const project = resolveProject();
|
|
@@ -20,14 +20,14 @@ function includeFileInBuild(file) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function copyRegistryFilesToSrc() {
|
|
23
|
-
const registryPath = path.resolve(buildPath,
|
|
24
|
-
const lazyPath = path.resolve(buildPath,
|
|
23
|
+
const registryPath = path.resolve(buildPath, 'registry/index.js');
|
|
24
|
+
const lazyPath = path.resolve(buildPath, 'lazy/index.js');
|
|
25
25
|
if (!fs.existsSync(registryPath) || !fs.existsSync(lazyPath)) return;
|
|
26
26
|
|
|
27
|
-
const srcPath = path.resolve(buildPath,
|
|
27
|
+
const srcPath = path.resolve(buildPath, 'src');
|
|
28
28
|
logger.debug(`Copying registry and lazy files to ${srcPath}`);
|
|
29
|
-
fs.copySync(registryPath, path.resolve(srcPath,
|
|
30
|
-
fs.copySync(lazyPath, path.resolve(srcPath,
|
|
29
|
+
fs.copySync(registryPath, path.resolve(srcPath, 'registry.js'));
|
|
30
|
+
fs.copySync(lazyPath, path.resolve(srcPath, 'lazy.js'));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -35,21 +35,23 @@ function copyRegistryFilesToSrc() {
|
|
|
35
35
|
*/
|
|
36
36
|
function createRootPackageFile() {
|
|
37
37
|
const packageData = fs.readFileSync(
|
|
38
|
-
path.resolve(packagePath,
|
|
39
|
-
|
|
38
|
+
path.resolve(packagePath, './package.json'),
|
|
39
|
+
'utf8'
|
|
40
40
|
);
|
|
41
|
+
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
43
|
const { nyc, scripts, devDependencies, workspaces, ...packageDataOther } =
|
|
42
44
|
JSON.parse(packageData);
|
|
43
45
|
const newPackageData = {
|
|
44
46
|
...packageDataOther,
|
|
45
47
|
private: false,
|
|
46
|
-
main:
|
|
47
|
-
module:
|
|
48
|
-
typings:
|
|
48
|
+
main: './cjs/index.js',
|
|
49
|
+
module: './index.js',
|
|
50
|
+
typings: './index.d.ts',
|
|
49
51
|
};
|
|
50
|
-
const targetPath = path.resolve(buildPath,
|
|
52
|
+
const targetPath = path.resolve(buildPath, './package.json');
|
|
51
53
|
|
|
52
|
-
fs.writeFileSync(targetPath, JSON.stringify(newPackageData, null, 2),
|
|
54
|
+
fs.writeFileSync(targetPath, JSON.stringify(newPackageData, null, 2), 'utf8');
|
|
53
55
|
logger.debug(`Created package.json in build directory`);
|
|
54
56
|
|
|
55
57
|
return newPackageData;
|
|
@@ -60,24 +62,24 @@ function createRootPackageFile() {
|
|
|
60
62
|
*
|
|
61
63
|
*/
|
|
62
64
|
function createNestedPackageFiles() {
|
|
63
|
-
const indexPaths = glob.sync(path.join(buildPath,
|
|
64
|
-
ignore: [path.join(buildPath,
|
|
65
|
+
const indexPaths = glob.sync(path.join(buildPath, '**/index.js'), {
|
|
66
|
+
ignore: [path.join(buildPath, 'cjs/**')],
|
|
65
67
|
});
|
|
66
68
|
|
|
67
69
|
indexPaths.forEach((indexPath) => {
|
|
68
|
-
if (indexPath === path.join(buildPath,
|
|
70
|
+
if (indexPath === path.join(buildPath, 'index.js')) return;
|
|
69
71
|
const packageData = {
|
|
70
72
|
sideEffects: false,
|
|
71
|
-
module:
|
|
72
|
-
types:
|
|
73
|
+
module: './index.js',
|
|
74
|
+
types: './index.d.ts',
|
|
73
75
|
main: path.relative(
|
|
74
76
|
path.dirname(indexPath),
|
|
75
|
-
indexPath.replace(buildPath, path.join(buildPath,
|
|
77
|
+
indexPath.replace(buildPath, path.join(buildPath, '/cjs'))
|
|
76
78
|
),
|
|
77
79
|
};
|
|
78
80
|
fs.writeFileSync(
|
|
79
|
-
path.join(path.dirname(indexPath),
|
|
80
|
-
JSON.stringify(packageData, null, 2)
|
|
81
|
+
path.join(path.dirname(indexPath), 'package.json'),
|
|
82
|
+
JSON.stringify(packageData, null, 2)
|
|
81
83
|
);
|
|
82
84
|
});
|
|
83
85
|
}
|
|
@@ -89,8 +91,8 @@ function createNestedPackageFiles() {
|
|
|
89
91
|
* @param {string} string - The string to prepend
|
|
90
92
|
*/
|
|
91
93
|
function prepend(file, string) {
|
|
92
|
-
const data = fs.readFileSync(file,
|
|
93
|
-
fs.writeFileSync(file, string + data,
|
|
94
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
95
|
+
fs.writeFileSync(file, string + data, 'utf8');
|
|
94
96
|
logger.debug(`Prepended license to ${file}`);
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -100,21 +102,21 @@ function prepend(file, string) {
|
|
|
100
102
|
* @param {object} packageData - The package data
|
|
101
103
|
*/
|
|
102
104
|
function addLicense(packageData) {
|
|
103
|
-
const license = `/** @license Digigov v${packageData[
|
|
105
|
+
const license = `/** @license Digigov v${packageData['version']}
|
|
104
106
|
*
|
|
105
107
|
* This source code is licensed under the BSD-2-Clause license found in the
|
|
106
108
|
* LICENSE file in the root directory of this source tree.
|
|
107
109
|
*/
|
|
108
110
|
`;
|
|
109
|
-
[
|
|
111
|
+
['./index.js', './index.mjs'].map(async (file) => {
|
|
110
112
|
try {
|
|
111
113
|
prepend(path.resolve(buildPath, file), license);
|
|
112
114
|
} catch (err) {
|
|
113
115
|
if (
|
|
114
|
-
typeof err ===
|
|
116
|
+
typeof err === 'object' &&
|
|
115
117
|
err &&
|
|
116
|
-
|
|
117
|
-
err.code ===
|
|
118
|
+
'code' in err &&
|
|
119
|
+
err.code === 'ENOENT'
|
|
118
120
|
) {
|
|
119
121
|
logger.debug(`Skipped license for ${file}`);
|
|
120
122
|
} else {
|
|
@@ -128,13 +130,13 @@ function addLicense(packageData) {
|
|
|
128
130
|
* Create separate index modules for each directory
|
|
129
131
|
*/
|
|
130
132
|
function createSeparateIndexModules() {
|
|
131
|
-
const files = glob.sync(path.join(buildPath,
|
|
132
|
-
ignore: [path.join(buildPath,
|
|
133
|
+
const files = glob.sync(path.join(buildPath, '**/*.js'), {
|
|
134
|
+
ignore: [path.join(buildPath, '**/index.js')],
|
|
133
135
|
});
|
|
134
136
|
|
|
135
137
|
files.forEach((file) => {
|
|
136
|
-
fs.mkdirSync(file.replace(/\.js$/,
|
|
137
|
-
fs.renameSync(file, file.replace(/\.js$/,
|
|
138
|
+
fs.mkdirSync(file.replace(/\.js$/, ''));
|
|
139
|
+
fs.renameSync(file, file.replace(/\.js$/, '/index.js'));
|
|
138
140
|
});
|
|
139
141
|
}
|
|
140
142
|
|
|
@@ -150,10 +152,10 @@ export default function run() {
|
|
|
150
152
|
[
|
|
151
153
|
// use enhanced readme from workspace root for `@digigov/ui`
|
|
152
154
|
// packageData.name === '@digigov/ui' ? '../../README.md' : './README.md',
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
].map((file) => includeFileInBuild(file))
|
|
158
|
-
|
|
155
|
+
'./src',
|
|
156
|
+
'./README.md',
|
|
157
|
+
'./CHANGELOG.md',
|
|
158
|
+
'../../LICENSE',
|
|
159
|
+
].map((file) => includeFileInBuild(file));
|
|
160
|
+
addLicense(packageData);
|
|
159
161
|
}
|
package/eslint.config.js
ADDED
package/generate-registry.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import path from
|
|
3
|
-
import fs from
|
|
4
|
-
import { SyntaxKind, Project as TsMorphProject } from
|
|
5
|
-
import assert from
|
|
1
|
+
import { logger } from '@digigov/cli/lib';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import { SyntaxKind, Project as TsMorphProject } from 'ts-morph';
|
|
5
|
+
import assert from 'assert';
|
|
6
6
|
|
|
7
|
-
import { getProjectTsconfig } from
|
|
7
|
+
import { getProjectTsconfig } from './common.js';
|
|
8
8
|
|
|
9
9
|
/** @typedef {Object} Project - Represents the project to be built
|
|
10
10
|
* @property {string} root - The project root directory
|
|
@@ -23,17 +23,17 @@ import { getProjectTsconfig } from "./common.js";
|
|
|
23
23
|
export async function generateRegistry(
|
|
24
24
|
project,
|
|
25
25
|
absoluteFilePaths,
|
|
26
|
-
registryFilename =
|
|
26
|
+
registryFilename = 'registry.js'
|
|
27
27
|
) {
|
|
28
28
|
const registryPath = ensureRegistryPath(project, registryFilename);
|
|
29
29
|
|
|
30
30
|
const relativePaths = absoluteFilePaths.map((path) => {
|
|
31
31
|
assert(
|
|
32
32
|
path.startsWith(project.root),
|
|
33
|
-
|
|
33
|
+
'Expected path to be in project root'
|
|
34
34
|
);
|
|
35
35
|
return toNodeResolvablePath(
|
|
36
|
-
path.replace(`${project.root}/src/`, `${project.name}/`)
|
|
36
|
+
path.replace(`${project.root}/src/`, `${project.name}/`)
|
|
37
37
|
);
|
|
38
38
|
});
|
|
39
39
|
let registryPaths = relativePaths.map((path) => ({
|
|
@@ -43,22 +43,22 @@ export async function generateRegistry(
|
|
|
43
43
|
|
|
44
44
|
if (registryPaths.length === 0)
|
|
45
45
|
throw new Error(
|
|
46
|
-
|
|
46
|
+
'Could not generate registry. No exportable modules found.'
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const importStatements = registryPaths.map(
|
|
50
|
-
(file) => `import * as ${file.uid} from "${file.path}"
|
|
50
|
+
(file) => `import * as ${file.uid} from "${file.path}";`
|
|
51
51
|
);
|
|
52
52
|
const componentsToExport = registryPaths.map(
|
|
53
|
-
(file) => ` '${file.path}': lazyImport(${file.uid})
|
|
53
|
+
(file) => ` '${file.path}': lazyImport(${file.uid})`
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
logger.debug(
|
|
57
|
-
`Including ${componentsToExport.length} items in ${registryPath}
|
|
57
|
+
`Including ${componentsToExport.length} items in ${registryPath}`
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
let registryFileContent = `
|
|
61
|
-
${importStatements.join(
|
|
61
|
+
${importStatements.join('\n')}
|
|
62
62
|
function lazyImport(pkgImport) {
|
|
63
63
|
return new Proxy(
|
|
64
64
|
{},
|
|
@@ -78,7 +78,7 @@ function lazyImport(pkgImport) {
|
|
|
78
78
|
)
|
|
79
79
|
}
|
|
80
80
|
export default {
|
|
81
|
-
${componentsToExport.join(
|
|
81
|
+
${componentsToExport.join(',\n')}
|
|
82
82
|
};
|
|
83
83
|
`;
|
|
84
84
|
await fs.writeFile(registryPath, registryFileContent);
|
|
@@ -97,7 +97,7 @@ ${componentsToExport.join(",\n")}
|
|
|
97
97
|
export async function generateLazyRegistry(
|
|
98
98
|
project,
|
|
99
99
|
filePaths,
|
|
100
|
-
lazyFilename =
|
|
100
|
+
lazyFilename = 'lazy.js'
|
|
101
101
|
) {
|
|
102
102
|
const lazyPath = ensureRegistryPath(project, lazyFilename);
|
|
103
103
|
|
|
@@ -117,7 +117,7 @@ export async function generateLazyRegistry(
|
|
|
117
117
|
|
|
118
118
|
for (const exportedComponent of exports) {
|
|
119
119
|
if (
|
|
120
|
-
exportedComponent !==
|
|
120
|
+
exportedComponent !== 'default' &&
|
|
121
121
|
exportedComponent.match(/^[A-Z]/)
|
|
122
122
|
) {
|
|
123
123
|
if (
|
|
@@ -125,7 +125,7 @@ export async function generateLazyRegistry(
|
|
|
125
125
|
allComponents[exportedComponent].length < filePath.length // Make import path more specific
|
|
126
126
|
) {
|
|
127
127
|
allComponents[exportedComponent] = toNodeResolvablePath(
|
|
128
|
-
filePath.replace(`${project.root}/src/`, `${project.name}/`)
|
|
128
|
+
filePath.replace(`${project.root}/src/`, `${project.name}/`)
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -136,7 +136,7 @@ export async function generateLazyRegistry(
|
|
|
136
136
|
|
|
137
137
|
if (componentCount === 0)
|
|
138
138
|
throw new Error(
|
|
139
|
-
|
|
139
|
+
'Could not generate lazy registry. No exportable components found.'
|
|
140
140
|
);
|
|
141
141
|
|
|
142
142
|
logger.debug(`Including ${componentCount} components in ${lazyPath}`);
|
|
@@ -144,9 +144,9 @@ export async function generateLazyRegistry(
|
|
|
144
144
|
const componentsToExport = Object.entries(allComponents)
|
|
145
145
|
.map(
|
|
146
146
|
([component, filePath]) =>
|
|
147
|
-
` '${component}': lazy(() => import('${filePath}').then((module) => ({ default: module['${component}'] })))
|
|
147
|
+
` '${component}': lazy(() => import('${filePath}').then((module) => ({ default: module['${component}'] })))`
|
|
148
148
|
)
|
|
149
|
-
.join(
|
|
149
|
+
.join(',\n');
|
|
150
150
|
|
|
151
151
|
const lazyFileContent = `import { lazy } from 'react';
|
|
152
152
|
export default {
|
|
@@ -182,7 +182,7 @@ function toNodeResolvablePath(inputPath) {
|
|
|
182
182
|
const dir = path.dirname(inputPath);
|
|
183
183
|
const base = path.basename(inputPath, path.extname(inputPath));
|
|
184
184
|
|
|
185
|
-
return base ===
|
|
185
|
+
return base === 'index' ? dir : path.join(dir, base);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
/**
|
|
@@ -192,7 +192,7 @@ function toNodeResolvablePath(inputPath) {
|
|
|
192
192
|
* @returns {string} - The UID
|
|
193
193
|
*/
|
|
194
194
|
function createUid(inputPath) {
|
|
195
|
-
return inputPath.replace(/[
|
|
195
|
+
return inputPath.replace(/[/@\-.]/g, '_');
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
package/index.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { DigigovCommand, resolveProject, logger } from
|
|
2
|
-
import { buildFormat, generateTypeDeclarationFiles } from
|
|
3
|
-
import { generateLazyRegistry, generateRegistry } from
|
|
4
|
-
import copyFiles from
|
|
1
|
+
import { DigigovCommand, resolveProject, logger } from '@digigov/cli/lib';
|
|
2
|
+
import { buildFormat, generateTypeDeclarationFiles } from './build.js';
|
|
3
|
+
import { generateLazyRegistry, generateRegistry } from './generate-registry.js';
|
|
4
|
+
import copyFiles from './copy-files.js';
|
|
5
5
|
|
|
6
|
-
import { Option } from
|
|
7
|
-
import path from
|
|
8
|
-
import glob from
|
|
9
|
-
import assert from
|
|
10
|
-
import { getProjectTsconfig } from
|
|
6
|
+
import { Option } from 'commander';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import glob from 'globby';
|
|
9
|
+
import assert from 'assert';
|
|
10
|
+
import { getProjectTsconfig } from './common.js';
|
|
11
11
|
|
|
12
|
-
const command = new DigigovCommand(
|
|
12
|
+
const command = new DigigovCommand('build', import.meta.url)
|
|
13
13
|
.option(
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
'--generate-registry',
|
|
15
|
+
'Generate a registry file for the build output'
|
|
16
16
|
)
|
|
17
17
|
.addOption(
|
|
18
|
-
new Option(
|
|
18
|
+
new Option('--include-stories', 'Include stories in the output').implies({
|
|
19
19
|
generateRegistry: true,
|
|
20
|
-
})
|
|
20
|
+
})
|
|
21
21
|
)
|
|
22
22
|
.action(main);
|
|
23
23
|
export default command;
|
|
24
24
|
|
|
25
|
-
const SRC_GLOB =
|
|
25
|
+
const SRC_GLOB = 'src/**/*.{tsx,ts,js,jsx}';
|
|
26
26
|
const TEST_GLOBS = [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
'**/*.test.{js,jsx,ts,tsx}',
|
|
28
|
+
'**/*.spec.{js,jsx,ts,tsx}',
|
|
29
|
+
'**/__tests__/**/*.{js,jsx,ts,tsx}',
|
|
30
30
|
];
|
|
31
31
|
const STORIES_GLOBS = [
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
'**/*.stories.{js,jsx,ts,tsx}',
|
|
33
|
+
'**/__stories__/**/*.{js,jsxts,tsx}',
|
|
34
34
|
];
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -42,7 +42,7 @@ const STORIES_GLOBS = [
|
|
|
42
42
|
async function main(options, ctx) {
|
|
43
43
|
const project = resolveProject();
|
|
44
44
|
|
|
45
|
-
await ctx.exec(
|
|
45
|
+
await ctx.exec('rimraf', [project.distDir]);
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* The project tsconfig, or undefined if the project is not using TypeScript
|
|
@@ -51,7 +51,7 @@ async function main(options, ctx) {
|
|
|
51
51
|
let tsconfig;
|
|
52
52
|
if (project.isTs) {
|
|
53
53
|
tsconfig = getProjectTsconfig(project.root);
|
|
54
|
-
assert(tsconfig,
|
|
54
|
+
assert(tsconfig, 'Expected tsconfig to be in project');
|
|
55
55
|
await generateTypeDeclarationFiles(project, tsconfig, ctx);
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -59,44 +59,44 @@ async function main(options, ctx) {
|
|
|
59
59
|
const filesToBuild = await glob(path.join(project.root, SRC_GLOB), {
|
|
60
60
|
ignore,
|
|
61
61
|
});
|
|
62
|
-
logger.debug(
|
|
62
|
+
logger.debug('Bundling ESM and CJS...');
|
|
63
63
|
await Promise.all([
|
|
64
64
|
buildFormat({
|
|
65
65
|
files: filesToBuild,
|
|
66
66
|
tsconfig: tsconfig,
|
|
67
|
-
format:
|
|
68
|
-
outdir: project.distDir +
|
|
67
|
+
format: 'cjs',
|
|
68
|
+
outdir: project.distDir + '/cjs',
|
|
69
69
|
}),
|
|
70
70
|
buildFormat({
|
|
71
71
|
files: filesToBuild,
|
|
72
72
|
tsconfig,
|
|
73
|
-
format:
|
|
73
|
+
format: 'esm',
|
|
74
74
|
outdir: project.distDir,
|
|
75
75
|
}),
|
|
76
76
|
]);
|
|
77
|
-
logger.debug(
|
|
77
|
+
logger.debug('Bundling done.');
|
|
78
78
|
|
|
79
79
|
if (options.generateRegistry) {
|
|
80
|
-
logger.debug(
|
|
80
|
+
logger.debug('Generating registry files...');
|
|
81
81
|
|
|
82
82
|
const filesToIncludeInRegistry = filesToBuild.filter(
|
|
83
|
-
(file) => !(file.includes(
|
|
83
|
+
(file) => !(file.includes('native') || file.endsWith('.d.ts'))
|
|
84
84
|
);
|
|
85
85
|
let storiesFiles = null;
|
|
86
86
|
if (options.includeStories) {
|
|
87
|
-
logger.debug(
|
|
87
|
+
logger.debug('Including stories in the registry...');
|
|
88
88
|
|
|
89
89
|
storiesFiles = await glob(
|
|
90
90
|
STORIES_GLOBS.map((glob) => path.join(project.root, project.src, glob)),
|
|
91
91
|
{
|
|
92
|
-
ignore: [
|
|
93
|
-
}
|
|
92
|
+
ignore: ['**/*.native.*, **/*.d.ts'],
|
|
93
|
+
}
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const [
|
|
97
|
+
const [, ...registryFilePaths] = await Promise.all([
|
|
98
98
|
storiesFiles
|
|
99
|
-
? generateRegistry(project, storiesFiles,
|
|
99
|
+
? generateRegistry(project, storiesFiles, 'stories-registry.js')
|
|
100
100
|
: null,
|
|
101
101
|
generateRegistry(project, filesToIncludeInRegistry),
|
|
102
102
|
generateLazyRegistry(project, filesToIncludeInRegistry),
|
|
@@ -105,14 +105,14 @@ async function main(options, ctx) {
|
|
|
105
105
|
buildFormat({
|
|
106
106
|
files: registryFilePaths,
|
|
107
107
|
tsconfig: tsconfig,
|
|
108
|
-
format:
|
|
109
|
-
outdir: project.distDir +
|
|
108
|
+
format: 'cjs',
|
|
109
|
+
outdir: project.distDir + '/cjs',
|
|
110
110
|
noLogs: true,
|
|
111
|
-
})
|
|
112
|
-
|
|
111
|
+
});
|
|
112
|
+
logger.log('Generated registry files');
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
logger.debug(
|
|
115
|
+
logger.debug('Copying files to build directory...');
|
|
116
116
|
copyFiles();
|
|
117
|
-
logger.debug(
|
|
117
|
+
logger.debug('Files copied.');
|
|
118
118
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/cli-build",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-16da9467",
|
|
4
4
|
"description": "Build plugin for Digigov CLI",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,27 +8,8 @@
|
|
|
8
8
|
"license": "BSD-2-Clause",
|
|
9
9
|
"private": false,
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@babel/cli": "7.12.1",
|
|
12
|
-
"@babel/compat-data": "7.12.5",
|
|
13
|
-
"@babel/core": "7.26.0",
|
|
14
|
-
"@babel/helper-validator-identifier": "7.9.5",
|
|
15
|
-
"@babel/plugin-proposal-class-properties": "7.12.1",
|
|
16
|
-
"@babel/plugin-proposal-object-rest-spread": "7.12.1",
|
|
17
|
-
"@babel/plugin-transform-object-assign": "7.12.1",
|
|
18
|
-
"@babel/plugin-transform-runtime": "7.12.1",
|
|
19
|
-
"@babel/preset-env": "7.12.13",
|
|
20
|
-
"@babel/preset-react": "7.12.13",
|
|
21
|
-
"@babel/preset-typescript": "7.12.1",
|
|
22
|
-
"babel-plugin-inline-import-data-uri": "1.0.1",
|
|
23
|
-
"babel-plugin-module-resolver": "4.0.0",
|
|
24
|
-
"babel-plugin-optimize-clsx": "1.1.1",
|
|
25
|
-
"babel-plugin-react-remove-properties": "0.3.0",
|
|
26
|
-
"babel-plugin-transform-dev-warning": "0.1.1",
|
|
27
|
-
"babel-plugin-transform-react-constant-elements": "6.23.0",
|
|
28
|
-
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
|
|
29
11
|
"fs-extra": "11.2.0",
|
|
30
12
|
"globby": "11.0.0",
|
|
31
|
-
"babel-plugin-istanbul": "7.0.0",
|
|
32
13
|
"publint": "0.1.8",
|
|
33
14
|
"rimraf": "3.0.2",
|
|
34
15
|
"esbuild": "0.23.0",
|
|
@@ -36,15 +17,19 @@
|
|
|
36
17
|
"ts-morph": "25.0.0"
|
|
37
18
|
},
|
|
38
19
|
"devDependencies": {
|
|
20
|
+
"@digigov/cli": "2.0.0-16da9467",
|
|
21
|
+
"@digigov/cli-lint": "2.0.0-16da9467",
|
|
39
22
|
"publint": "0.1.8",
|
|
40
23
|
"vitest": "2.1.3",
|
|
41
|
-
"@digigov/cli-test": "2.0.0-
|
|
24
|
+
"@digigov/cli-test": "2.0.0-16da9467",
|
|
42
25
|
"@types/fs-extra": "11.0.4",
|
|
43
|
-
"@types/node": "
|
|
44
|
-
"typescript": "5.6.2"
|
|
26
|
+
"@types/node": "20.17.24",
|
|
27
|
+
"typescript": "5.6.2",
|
|
28
|
+
"eslint": "9.16.0",
|
|
29
|
+
"prettier": "3.4.2"
|
|
45
30
|
},
|
|
46
31
|
"peerDependencies": {
|
|
47
|
-
"@digigov/cli": "2.0.0-
|
|
32
|
+
"@digigov/cli": "2.0.0-16da9467",
|
|
48
33
|
"next": "13.1.1"
|
|
49
34
|
},
|
|
50
35
|
"peerDependenciesMeta": {
|
|
@@ -53,6 +38,8 @@
|
|
|
53
38
|
}
|
|
54
39
|
},
|
|
55
40
|
"scripts": {
|
|
56
|
-
"publint": "publint"
|
|
41
|
+
"publint": "publint",
|
|
42
|
+
"lint": "digigov lint",
|
|
43
|
+
"typecheck": "tsc"
|
|
57
44
|
}
|
|
58
45
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@digigov/cli/tsconfig.cli",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"types": [
|
|
5
|
-
"vitest/globals"
|
|
6
|
-
]
|
|
4
|
+
"types": ["vitest/globals"]
|
|
7
5
|
},
|
|
8
|
-
"include": [
|
|
9
|
-
|
|
10
|
-
"__tests__"
|
|
11
|
-
]
|
|
6
|
+
"include": ["./*.js", "__tests__"],
|
|
7
|
+
"exclude": ["eslint.config.js", ".prettierrc.cjs"]
|
|
12
8
|
}
|