@xylabs/ts-scripts-yarn3 2.8.0-rc.6 → 2.8.0-rc.8
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/dist/cjs/actions/compile.js +6 -6
- package/dist/cjs/actions/compile.js.map +1 -1
- package/dist/cjs/actions/copy-assets.d.ts +1 -1
- package/dist/cjs/actions/copy-assets.d.ts.map +1 -1
- package/dist/cjs/actions/copy-assets.js +38 -19
- package/dist/cjs/actions/copy-assets.js.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-cjs.d.ts +1 -1
- package/dist/cjs/actions/tsconfig-gen-cjs.d.ts.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-cjs.js +17 -5
- package/dist/cjs/actions/tsconfig-gen-cjs.js.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-clean.d.ts +1 -1
- package/dist/cjs/actions/tsconfig-gen-clean.d.ts.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-clean.js +20 -2
- package/dist/cjs/actions/tsconfig-gen-clean.js.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-esm.d.ts +1 -1
- package/dist/cjs/actions/tsconfig-gen-esm.d.ts.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-esm.js +17 -5
- package/dist/cjs/actions/tsconfig-gen-esm.js.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-test.d.ts +1 -1
- package/dist/cjs/actions/tsconfig-gen-test.d.ts.map +1 -1
- package/dist/cjs/actions/tsconfig-gen-test.js +5 -2
- package/dist/cjs/actions/tsconfig-gen-test.js.map +1 -1
- package/dist/cjs/actions/tsconfig-gen.d.ts +1 -1
- package/dist/cjs/actions/tsconfig-gen.d.ts.map +1 -1
- package/dist/cjs/actions/tsconfig-gen.js +4 -4
- package/dist/cjs/actions/tsconfig-gen.js.map +1 -1
- package/dist/cjs/actions/upplug.js +4 -4
- package/dist/cjs/actions/upplug.js.map +1 -1
- package/dist/cjs/lib/xy.d.ts +2 -2
- package/dist/cjs/lib/xy.js +3 -3
- package/dist/cjs/lib/xy.js.map +1 -1
- package/dist/esm/actions/compile.js +6 -6
- package/dist/esm/actions/compile.js.map +1 -1
- package/dist/esm/actions/copy-assets.d.ts +1 -1
- package/dist/esm/actions/copy-assets.d.ts.map +1 -1
- package/dist/esm/actions/copy-assets.js +37 -18
- package/dist/esm/actions/copy-assets.js.map +1 -1
- package/dist/esm/actions/tsconfig-gen-cjs.d.ts +1 -1
- package/dist/esm/actions/tsconfig-gen-cjs.d.ts.map +1 -1
- package/dist/esm/actions/tsconfig-gen-cjs.js +17 -5
- package/dist/esm/actions/tsconfig-gen-cjs.js.map +1 -1
- package/dist/esm/actions/tsconfig-gen-clean.d.ts +1 -1
- package/dist/esm/actions/tsconfig-gen-clean.d.ts.map +1 -1
- package/dist/esm/actions/tsconfig-gen-clean.js +21 -3
- package/dist/esm/actions/tsconfig-gen-clean.js.map +1 -1
- package/dist/esm/actions/tsconfig-gen-esm.d.ts +1 -1
- package/dist/esm/actions/tsconfig-gen-esm.d.ts.map +1 -1
- package/dist/esm/actions/tsconfig-gen-esm.js +17 -5
- package/dist/esm/actions/tsconfig-gen-esm.js.map +1 -1
- package/dist/esm/actions/tsconfig-gen-test.d.ts +1 -1
- package/dist/esm/actions/tsconfig-gen-test.d.ts.map +1 -1
- package/dist/esm/actions/tsconfig-gen-test.js +5 -2
- package/dist/esm/actions/tsconfig-gen-test.js.map +1 -1
- package/dist/esm/actions/tsconfig-gen.d.ts +1 -1
- package/dist/esm/actions/tsconfig-gen.d.ts.map +1 -1
- package/dist/esm/actions/tsconfig-gen.js +4 -4
- package/dist/esm/actions/tsconfig-gen.js.map +1 -1
- package/dist/esm/actions/upplug.js +4 -4
- package/dist/esm/actions/upplug.js.map +1 -1
- package/dist/esm/lib/xy.d.ts +2 -2
- package/dist/esm/lib/xy.js +2 -2
- package/dist/esm/lib/xy.js.map +1 -1
- package/dist/tsconfig.build.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.build.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/actions/compile.ts +6 -6
- package/src/actions/copy-assets.ts +44 -23
- package/src/actions/tsconfig-gen-cjs.ts +16 -5
- package/src/actions/tsconfig-gen-clean.ts +22 -3
- package/src/actions/tsconfig-gen-esm.ts +16 -5
- package/src/actions/tsconfig-gen-test.ts +5 -2
- package/src/actions/tsconfig-gen.ts +4 -4
- package/src/actions/upplug.ts +4 -4
- package/src/lib/xy.ts +2 -2
|
@@ -9,36 +9,57 @@ export interface CopyAssetsParams {
|
|
|
9
9
|
pkg?: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
parents: true,
|
|
25
|
-
},
|
|
26
|
-
)
|
|
27
|
-
.then((values) => values.forEach((value) => console.log(`Copied: ${value}`)))
|
|
28
|
-
.catch((reason) => {
|
|
29
|
-
console.log(`Copy Failed: ${name}: ${reason}`)
|
|
30
|
-
return 1
|
|
31
|
-
})
|
|
12
|
+
const copyPackageTargetAssets = async (target: 'esm' | 'cjs', name: string, location: string) => {
|
|
13
|
+
try {
|
|
14
|
+
const values = await cpy(
|
|
15
|
+
['**/*.jpg', '**/*.png', '**/*.gif', '**/*.svg', '**/*.webp', '**/*.sass', '**/*.scss', '**/*.gif', '**/*.css'],
|
|
16
|
+
`../dist/${target}`,
|
|
17
|
+
{
|
|
18
|
+
cwd: path.join(process.cwd(), location, 'src'),
|
|
19
|
+
parents: true,
|
|
20
|
+
},
|
|
21
|
+
)
|
|
22
|
+
values.forEach((value) => {
|
|
23
|
+
console.log(`Copied: ${value}`)
|
|
32
24
|
})
|
|
33
25
|
return 0
|
|
26
|
+
} catch (reason) {
|
|
27
|
+
console.log(`Copy Failed: ${name}: ${reason}`)
|
|
28
|
+
return 1
|
|
34
29
|
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const copyTargetAssets = async (target: 'esm' | 'cjs', pkg?: string) => {
|
|
33
|
+
const workspaces = yarnWorkspaces()
|
|
34
|
+
|
|
35
|
+
console.log(chalk.green(`Copying Assets [${target.toUpperCase()}]`))
|
|
36
|
+
|
|
37
|
+
//finds the package or returns all if undefined
|
|
38
|
+
const workspaceList = workspaces.filter(({ name }) => {
|
|
39
|
+
return pkg === undefined || name === pkg
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
if (workspaceList.length === 0) {
|
|
43
|
+
console.error(`Package not found [${pkg}]`)
|
|
44
|
+
} else {
|
|
45
|
+
const results = await Promise.all(
|
|
46
|
+
workspaceList.map(async (workspace) => {
|
|
47
|
+
const { location, name } = workspace
|
|
48
|
+
return await copyPackageTargetAssets(target, name, location)
|
|
49
|
+
}),
|
|
50
|
+
)
|
|
51
|
+
return results.reduce((prev, result) => prev || result, 0)
|
|
52
|
+
}
|
|
53
|
+
return 0
|
|
54
|
+
}
|
|
35
55
|
|
|
56
|
+
export const copyAssets = async ({ target, pkg }: CopyAssetsParams) => {
|
|
36
57
|
switch (target) {
|
|
37
58
|
case 'esm':
|
|
38
|
-
return
|
|
59
|
+
return await copyTargetAssets('esm', pkg)
|
|
39
60
|
case 'cjs':
|
|
40
|
-
return
|
|
61
|
+
return await copyTargetAssets('cjs', pkg)
|
|
41
62
|
default:
|
|
42
|
-
return
|
|
63
|
+
return (await copyTargetAssets('esm', pkg)) || (await copyTargetAssets('cjs', pkg))
|
|
43
64
|
}
|
|
44
65
|
}
|
|
@@ -3,8 +3,11 @@ import { writeFileSync } from 'fs'
|
|
|
3
3
|
|
|
4
4
|
import { yarnWorkspaces } from '../lib'
|
|
5
5
|
|
|
6
|
-
export const tsconfigGenCjs = () => {
|
|
6
|
+
export const tsconfigGenCjs = (pkg?: string) => {
|
|
7
7
|
const workspaces = yarnWorkspaces()
|
|
8
|
+
const workspaceList = workspaces.filter(({ name }) => {
|
|
9
|
+
return pkg === undefined || name === pkg
|
|
10
|
+
})
|
|
8
11
|
|
|
9
12
|
console.log(chalk.green('Generate Configs [CJS]'))
|
|
10
13
|
|
|
@@ -23,8 +26,16 @@ export const tsconfigGenCjs = () => {
|
|
|
23
26
|
2,
|
|
24
27
|
)
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
return workspaceList
|
|
30
|
+
.map(({ location, name }) => {
|
|
31
|
+
try {
|
|
32
|
+
writeFileSync(`${location}/.tsconfig.build.cjs.json`, config)
|
|
33
|
+
return 0
|
|
34
|
+
} catch (ex) {
|
|
35
|
+
const error = ex as Error
|
|
36
|
+
console.error(`tsconfig (CJS) generate failed [${name}] [${error.message}]`)
|
|
37
|
+
return 1
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.reduce((prev, value) => prev || value, 0)
|
|
30
41
|
}
|
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rmSync } from 'fs'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { yarnWorkspaces } from '../lib'
|
|
4
|
+
|
|
5
|
+
export const tsconfigGenClean = (pkg?: string) => {
|
|
6
|
+
const workspaces = yarnWorkspaces()
|
|
7
|
+
const workspaceList = workspaces.filter(({ name }) => {
|
|
8
|
+
return pkg === undefined || name === pkg
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
return workspaceList
|
|
12
|
+
.map(({ location, name }) => {
|
|
13
|
+
const dist = `${location}/**/.tsconfig*`
|
|
14
|
+
try {
|
|
15
|
+
rmSync(dist, { force: true, recursive: true })
|
|
16
|
+
return 0
|
|
17
|
+
} catch (ex) {
|
|
18
|
+
const error = ex as Error
|
|
19
|
+
console.error(`Clean Failed [${name}, ${error.message}]`)
|
|
20
|
+
return 1
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
.reduce((prev, result) => prev || result, 0)
|
|
5
24
|
}
|
|
@@ -3,8 +3,11 @@ import { writeFileSync } from 'fs'
|
|
|
3
3
|
|
|
4
4
|
import { yarnWorkspaces } from '../lib'
|
|
5
5
|
|
|
6
|
-
export const tsconfigGenEsm = () => {
|
|
6
|
+
export const tsconfigGenEsm = (pkg?: string) => {
|
|
7
7
|
const workspaces = yarnWorkspaces()
|
|
8
|
+
const workspaceList = workspaces.filter(({ name }) => {
|
|
9
|
+
return pkg === undefined || name === pkg
|
|
10
|
+
})
|
|
8
11
|
|
|
9
12
|
console.log(chalk.green('Generate Configs [ESM]'))
|
|
10
13
|
|
|
@@ -23,8 +26,16 @@ export const tsconfigGenEsm = () => {
|
|
|
23
26
|
2,
|
|
24
27
|
)
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
return workspaceList
|
|
30
|
+
.map(({ location, name }) => {
|
|
31
|
+
try {
|
|
32
|
+
writeFileSync(`${location}/.tsconfig.build.esm.json`, config)
|
|
33
|
+
return 0
|
|
34
|
+
} catch (ex) {
|
|
35
|
+
const error = ex as Error
|
|
36
|
+
console.error(`tsconfig (ESM) generate failed [${name}] [${error.message}]`)
|
|
37
|
+
return 1
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.reduce((prev, value) => prev || value, 0)
|
|
30
41
|
}
|
|
@@ -3,8 +3,11 @@ import { writeFileSync } from 'fs'
|
|
|
3
3
|
|
|
4
4
|
import { yarnWorkspaces } from '../lib'
|
|
5
5
|
|
|
6
|
-
export const tsconfigGenTest = () => {
|
|
6
|
+
export const tsconfigGenTest = (pkg?: string) => {
|
|
7
7
|
const workspaces = yarnWorkspaces()
|
|
8
|
+
const workspaceList = workspaces.filter(({ name }) => {
|
|
9
|
+
return pkg === undefined || name === pkg
|
|
10
|
+
})
|
|
8
11
|
|
|
9
12
|
console.log(chalk.green('Generate Configs [Test]'))
|
|
10
13
|
|
|
@@ -17,7 +20,7 @@ export const tsconfigGenTest = () => {
|
|
|
17
20
|
2,
|
|
18
21
|
)
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
workspaceList.forEach(({ location }) => {
|
|
21
24
|
writeFileSync(`${location}/.tsconfig.build.test.json`, config)
|
|
22
25
|
})
|
|
23
26
|
return 0
|
|
@@ -7,13 +7,13 @@ export interface TsconfigGenParams {
|
|
|
7
7
|
pkg?: string
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const tsconfigGen = ({ target }: TsconfigGenParams) => {
|
|
10
|
+
export const tsconfigGen = ({ target, pkg }: TsconfigGenParams) => {
|
|
11
11
|
switch (target) {
|
|
12
12
|
case 'esm':
|
|
13
|
-
return tsconfigGenEsm() || tsconfigGenTest()
|
|
13
|
+
return tsconfigGenEsm(pkg) || tsconfigGenTest(pkg)
|
|
14
14
|
case 'cjs':
|
|
15
|
-
return tsconfigGenCjs() || tsconfigGenTest()
|
|
15
|
+
return tsconfigGenCjs(pkg) || tsconfigGenTest(pkg)
|
|
16
16
|
default:
|
|
17
|
-
return tsconfigGenEsm() || tsconfigGenCjs() || tsconfigGenTest()
|
|
17
|
+
return tsconfigGenEsm(pkg) || tsconfigGenCjs(pkg) || tsconfigGenTest(pkg)
|
|
18
18
|
}
|
|
19
19
|
}
|
package/src/actions/upplug.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { runSteps } from '../lib'
|
|
|
2
2
|
|
|
3
3
|
export const updateYarnPlugins = () => {
|
|
4
4
|
return runSteps('Update Yarn Plugins [Outdated]', [
|
|
5
|
-
['yarn', ['plugin', 'import', '
|
|
6
|
-
['yarn', ['plugin', 'import', '
|
|
7
|
-
['yarn', ['plugin', 'import', '
|
|
8
|
-
['yarn', ['plugin', 'import', '
|
|
5
|
+
['yarn', ['plugin', 'import', 'https://mskelton.dev/yarn-outdated/v3']],
|
|
6
|
+
['yarn', ['plugin', 'import', 'version']],
|
|
7
|
+
['yarn', ['plugin', 'import', 'interactive-tools']],
|
|
8
|
+
['yarn', ['plugin', 'import', 'workspace-tools']],
|
|
9
9
|
])
|
|
10
10
|
}
|
package/src/lib/xy.ts
CHANGED
|
@@ -131,9 +131,9 @@ export const xy = () => {
|
|
|
131
131
|
describe: 'Specific package to copy assets',
|
|
132
132
|
})
|
|
133
133
|
},
|
|
134
|
-
(argv) => {
|
|
134
|
+
async (argv) => {
|
|
135
135
|
if (argv.verbose) console.info(`Copying Assets: ${argv.package ?? 'all'}`)
|
|
136
|
-
process.exitCode = copyAssets({ target: argv.target as 'esm' | 'cjs' })
|
|
136
|
+
process.exitCode = await copyAssets({ target: argv.target as 'esm' | 'cjs' })
|
|
137
137
|
},
|
|
138
138
|
)
|
|
139
139
|
.command(
|