Skip to content

Commit 692edae

Browse files
committed
feat: update lock
1 parent 4efdb17 commit 692edae

File tree

15 files changed

+52
-45
lines changed

15 files changed

+52
-45
lines changed

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"create-client-declaration": "tsc --lib dom,es5,es6,scripthost --declaration src/client/index --declarationDir declare/client --skipLibCheck --outDir declare/client && find declare/client -type f -name \"*.js\" -delete",
99
"build": "rm -rf built && rm -rf .cache && tsc && npm run create-client-declaration",
1010
"prepublishOnly": "npm run build",
11-
"format": "eslint --fix './src/**/*.?(ts|tsx)'",
11+
"lint": "eslint --fix './src/**/*.?(ts|tsx)' && prettier --list-different --write './src/**'",
1212
"generateDocument": "typedoc --out ./document --mode file --ignoreCompilerErrors ./src/node/index.ts",
1313
"publishBeta": "npm publish --tag=beta",
1414
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
1515
},
1616
"husky": {
1717
"hooks": {
1818
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
19-
"pre-commit": "npm run format"
19+
"pre-commit": "npm run lint"
2020
}
2121
},
2222
"bin": {
@@ -86,7 +86,6 @@
8686
"eslint-import-resolver-webpack": "0.11.1",
8787
"eslint-plugin-babel": "5.3.0",
8888
"eslint-plugin-import": "2.18.2",
89-
"eslint-plugin-prettier": "3.1.1",
9089
"eslint-plugin-react": "7.16.0",
9190
"eslint-plugin-react-hooks": "2.2.0",
9291
"file-loader": "4.0.0",
@@ -151,4 +150,4 @@
151150
"worker-loader": "2.0.0",
152151
"yargs": "13.2.4"
153152
}
154-
}
153+
}

src/built-in-plugins/command-dev/plugin/component-dev.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const componentDev = async (watchOnly = false) => {
2828

2929
// Build all
3030
if (!watchOnly) {
31-
await spinner(`Init build`, async () => {
31+
await spinner('Init build', async () => {
3232
await tsPlusBabel(false, true);
3333
});
3434
}

src/built-in-plugins/command-dev/plugin/dashboard/client/pages/struct/struct.component.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const StructComponent = React.memo(() => {
5555
});
5656
}}
5757
>
58-
<ListItemText primary={`Layout`} />
58+
<ListItemText primary={'Layout'} />
5959
{!hasLayout && (
6060
<ListItemSecondaryAction>
6161
<Button onClick={createLayout}>Add</Button>
@@ -71,7 +71,7 @@ export const StructComponent = React.memo(() => {
7171
});
7272
}}
7373
>
74-
<ListItemText primary={`404`} />
74+
<ListItemText primary={'404'} />
7575
{!hasNotFound && (
7676
<ListItemSecondaryAction>
7777
<Button onClick={create404}>Add</Button>
@@ -87,7 +87,7 @@ export const StructComponent = React.memo(() => {
8787
});
8888
}}
8989
>
90-
<ListItemText primary={`Config`} />
90+
<ListItemText primary={'Config'} />
9191
{!hasConfig && (
9292
<ListItemSecondaryAction>
9393
<Button onClick={createConfig}>Add</Button>

src/built-in-plugins/command-dev/plugin/plugin-dev.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const pluginDev = async () => {
1313
});
1414

1515
// Build all
16-
await spinner(`Init build`, async () => {
16+
await spinner('Init build', async () => {
1717
await tsPlusBabel(false, true);
1818
});
1919
// Watch

src/built-in-plugins/command-dev/plugin/project-dev.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async function debugProject() {
8282
document.body.appendChild(dllScript);
8383
function runEntry() {
8484
`,
85-
`}`,
85+
'}',
8686
),
8787
);
8888
return config;

src/built-in-plugins/command-publish/plugin/run-publish.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async function publishByPackageName(
135135
await commandBundle({ skipLint: true });
136136
}
137137

138-
await spinner(`Publish`, async () => {
138+
await spinner('Publish', async () => {
139139
await moveSourceFilesToTempFolderAndPublish(sourceType, options, targetConfig, targetRoot, depMap, isDevelopBranch);
140140
});
141141

src/built-in-plugins/command-publish/plugin/utils.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ export function prePareParamsBeforePublish(sourceType: string) {
3939
config: targetConfig,
4040
};
4141

42-
return { targetPackageJson, targetConfig, targetRoot, targetPackageInfo };
42+
return {
43+
targetPackageJson,
44+
targetConfig,
45+
targetRoot,
46+
targetPackageInfo,
47+
};
4348
}
4449

4550
// check package.json and env etc.
@@ -61,7 +66,7 @@ export async function checkEnvBeforePublish(targetPackageJson: Partial<PackageJs
6166
}
6267

6368
export async function addTagAndPush(tagName: string, targetPackageJson: Partial<PackageJson>) {
64-
await spinner(`Add and push tag`, async () => {
69+
await spinner('Add and push tag', async () => {
6570
await exec(`git tag -a ${tagName} -m "release" -f`);
6671
await exec(`git push origin ${tagName} -f`);
6772
});
@@ -148,7 +153,7 @@ export async function generateVersion(
148153
} else if (['patch', 'minor', 'major'].some(each => each === options.semver)) {
149154
version = semver.inc(targetPackageJson.version, options.semver as semver.ReleaseType);
150155
} else {
151-
logFatal(`semver must be "patch" "minor" or "major"`);
156+
logFatal('semver must be "patch" "minor" or "major"');
152157
}
153158
}
154159
resolve(version);
@@ -181,7 +186,7 @@ export async function cleanWorkingTree() {
181186
]);
182187

183188
if (!inquirerInfo.message) {
184-
logFatal(`Need commit message`);
189+
logFatal('Need commit message');
185190
}
186191

187192
const result = await commitLint(inquirerInfo.message, {
@@ -338,7 +343,7 @@ export async function addMissingDeps(
338343

339344
export async function buildDeclaration() {
340345
// Create d.ts
341-
await spinner(`create declaration`, async () => {
346+
await spinner('create declaration', async () => {
342347
try {
343348
await exec(
344349
`npx tsc --declaration --declarationDir ${path.join(

src/built-in-plugins/ensure-project-files/plugin/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const commonComponentPackageJson = {
5858
analyse: 'pri analyse',
5959
publish: 'pri publish',
6060
lint: 'pri lint',
61-
format: `pri lint`,
61+
format: 'pri lint',
6262
test: 'pri test',
6363
},
6464
husky: {
@@ -334,7 +334,7 @@ function ensureRootPackageJson() {
334334
if (pri.selectedSourceType === 'root') {
335335
_.set(prevJson, 'main', `${pri.projectConfig.distDir}/main/src`);
336336
_.set(prevJson, 'module', `${pri.projectConfig.distDir}/module/src`);
337-
_.set(prevJson, 'types', `src`);
337+
_.set(prevJson, 'types', 'src');
338338
} else {
339339
_.set(prevJson, 'main', `${pri.projectConfig.distDir}/main/packages/${pri.selectedSourceType}/src`);
340340
_.set(prevJson, 'module', `${pri.projectConfig.distDir}/module/packages/${pri.selectedSourceType}/src`);

src/built-in-plugins/project-analyse-pages/plugin/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pri.project.onAnalyseProject(files => {
7676
pages: pri.sourceConfig.routes
7777
.filter(route => {
7878
if (route.redirect && route.component) {
79-
logFatal(`route "redirect" and "component" are mutually exclusive.`);
79+
logFatal('route "redirect" and "component" are mutually exclusive.');
8080
}
8181

8282
if (route.path && route.component) {

src/utils/create-entry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class Entry {
189189
}
190190

191191
protected async getEnvironmentHeader() {
192-
return pipe.get('environmentHeader', ``);
192+
return pipe.get('environmentHeader', '');
193193
}
194194

195195
protected async getEnvironmentBody() {

src/utils/define.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class GlobalState {
108108
/**
109109
* Development enviroment.
110110
*/
111-
public isDevelopment: boolean = false;
111+
public isDevelopment = false;
112112

113113
/**
114114
* packages info

src/utils/git-operate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ export const isWorkingTreeClean = async (cwd?: string) => {
5353
};
5454

5555
export const getCurrentBranchName = async (cwd?: string) => {
56-
const branchName = await exec(`git rev-parse --abbrev-ref HEAD 2>/dev/null`, { cwd });
56+
const branchName = await exec('git rev-parse --abbrev-ref HEAD 2>/dev/null', { cwd });
5757
return branchName;
5858
};

src/utils/global-state.ts

+22-19
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,28 @@ async function initPackages(cliCurrentPath: string, preSelectPackage: string) {
7676
const currentPackagesPath = path.join(cliCurrentPath, PACKAGES_NAME);
7777

7878
if (fs.existsSync(currentPackagesPath)) {
79-
globalState.packages = fs.readdirSync(currentPackagesPath).filter(folderName=>{
80-
if (folderName==='.DS_Store'){
81-
return false
82-
}
83-
84-
return true
85-
}).map(folderName => {
86-
const packagePath = path.join(cliCurrentPath, PACKAGES_NAME, folderName);
87-
const packageJson: PackageJson = fs.readJSONSync(path.join(packagePath, 'package.json'), { throws: false });
88-
89-
const config = fs.readJsonSync(path.join(packagePath, CONFIG_FILE), { throws: false }) || {};
90-
91-
return {
92-
name: folderName,
93-
rootPath: packagePath,
94-
packageJson,
95-
config,
96-
};
97-
});
79+
globalState.packages = fs
80+
.readdirSync(currentPackagesPath)
81+
.filter(folderName => {
82+
if (folderName === '.DS_Store') {
83+
return false;
84+
}
85+
86+
return true;
87+
})
88+
.map(folderName => {
89+
const packagePath = path.join(cliCurrentPath, PACKAGES_NAME, folderName);
90+
const packageJson: PackageJson = fs.readJSONSync(path.join(packagePath, 'package.json'), { throws: false });
91+
92+
const config = fs.readJsonSync(path.join(packagePath, CONFIG_FILE), { throws: false }) || {};
93+
94+
return {
95+
name: folderName,
96+
rootPath: packagePath,
97+
packageJson,
98+
config,
99+
};
100+
});
98101
}
99102

100103
if (globalState.packages.length > 0) {

src/utils/packages.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function getMonoDepASC(depMap: DepMap) {
157157
}
158158
});
159159

160-
logFatal(`Cyclic dependence happend!`);
160+
logFatal('Cyclic dependence happend!');
161161
}
162162

163163
monoDepASC.push(zeroMonoDepsPackageName);
@@ -190,7 +190,7 @@ export async function getMonoAndNpmDepsByPath(rootPath: string) {
190190
if ([ts.SyntaxKind.ImportDeclaration, ts.SyntaxKind.ExportDeclaration].includes(statement.kind)) {
191191
statement.forEachChild(each => {
192192
if (each.kind === ts.SyntaxKind.StringLiteral) {
193-
const importStringLiteral = _.trim(each.getText(sourceFile), `'"`);
193+
const importStringLiteral = _.trim(each.getText(sourceFile), '\'"');
194194
const targetPackage = globalState.packages.find(
195195
eachPackage => eachPackage.packageJson && eachPackage.packageJson.name === importStringLiteral,
196196
);

src/utils/type-checker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function typeChecker() {
1111

1212
try {
1313
debugFiles = execSync(
14-
`grep -in '@DEBUG' --include *.ts --include *.tsx --include *.js --include *.scss --include *.css $(git diff --cached --name-only --diff-filter=ACM) /dev/null`,
14+
"grep -in '@DEBUG' --include *.ts --include *.tsx --include *.js --include *.scss --include *.css $(git diff --cached --name-only --diff-filter=ACM) /dev/null",
1515
{
1616
shell: 'bash',
1717
stdio: [0, 1],
@@ -26,7 +26,7 @@ export function typeChecker() {
2626
}
2727
}
2828

29-
const tsChangedFilesCnt = +execSync(`git diff --cached --numstat --diff-filter=ACM | grep -F '.ts' | wc -l`).toString(
29+
const tsChangedFilesCnt = +execSync("git diff --cached --numstat --diff-filter=ACM | grep -F '.ts' | wc -l").toString(
3030
'utf8',
3131
);
3232
if (tsChangedFilesCnt) {

0 commit comments

Comments
 (0)