@abcnews/aunty 17.0.0-next.6 → 17.0.0-next.7
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/bin/aunty.js +12 -9
- package/dist/bin/commander.js +12 -9
- package/dist/src/lib/initHelpers.d.ts +6 -0
- package/package.json +1 -1
- package/src/commands/migrate/index.ts +5 -5
- package/src/lib/initHelpers.ts +10 -2
- package/templates/svelte/base/init.ts +1 -1
- package/templates/svelte/patch-builder/init.ts +1 -1
- package/templates/svelte/patch-scrollyteller/init.ts +1 -1
- package/templates/vanilla/base/init.ts +1 -1
package/dist/bin/aunty.js
CHANGED
|
@@ -851,10 +851,13 @@ async function getGitUser() {
|
|
|
851
851
|
return null;
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
|
+
function getAuntyRoot() {
|
|
855
|
+
return path5.resolve(import.meta.dirname, "../../");
|
|
856
|
+
}
|
|
854
857
|
async function installAunty(baseDir) {
|
|
855
858
|
const localDev = isLocalDevelopment();
|
|
856
859
|
let auntyDepValue = "";
|
|
857
|
-
const auntyRoot =
|
|
860
|
+
const auntyRoot = getAuntyRoot();
|
|
858
861
|
if (localDev) {
|
|
859
862
|
auntyDepValue = `file:${auntyRoot}`;
|
|
860
863
|
} else {
|
|
@@ -905,7 +908,7 @@ var init_initHelpers = __esm({
|
|
|
905
908
|
// templates/svelte/base/init.ts
|
|
906
909
|
import path6 from "node:path";
|
|
907
910
|
async function init({ projectName, baseDir }) {
|
|
908
|
-
const contentsDir = path6.resolve(
|
|
911
|
+
const contentsDir = path6.resolve(getAuntyRoot(), "templates/svelte/base/contents");
|
|
909
912
|
await copyContents(contentsDir, baseDir);
|
|
910
913
|
await replaceInFiles(
|
|
911
914
|
baseDir,
|
|
@@ -951,7 +954,7 @@ var init_init2 = __esm({
|
|
|
951
954
|
// templates/svelte/patch-scrollyteller/init.ts
|
|
952
955
|
import path7 from "node:path";
|
|
953
956
|
async function init3({ projectName, baseDir }) {
|
|
954
|
-
const contentsDir = path7.resolve(
|
|
957
|
+
const contentsDir = path7.resolve(getAuntyRoot(), "templates/svelte/patch-scrollyteller/contents");
|
|
955
958
|
await copyContents(contentsDir, baseDir);
|
|
956
959
|
await editPackageJson(baseDir, (pkg2) => {
|
|
957
960
|
pkg2.dependencies = pkg2.dependencies || {};
|
|
@@ -977,7 +980,7 @@ __export(init_exports, {
|
|
|
977
980
|
import path8 from "node:path";
|
|
978
981
|
import fs3 from "node:fs/promises";
|
|
979
982
|
async function init4({ projectName, baseDir }) {
|
|
980
|
-
const contentsDir = path8.resolve(
|
|
983
|
+
const contentsDir = path8.resolve(getAuntyRoot(), "templates/svelte/patch-builder/contents");
|
|
981
984
|
await copyContents(contentsDir, baseDir);
|
|
982
985
|
await replaceInFile(baseDir, "builder/index.html", {
|
|
983
986
|
__PROJECT_NAME__: projectName
|
|
@@ -1112,7 +1115,7 @@ var init_svelte = __esm({
|
|
|
1112
1115
|
// templates/vanilla/base/init.ts
|
|
1113
1116
|
import path9 from "node:path";
|
|
1114
1117
|
async function init6({ projectName, baseDir }) {
|
|
1115
|
-
const contentsDir = path9.resolve(
|
|
1118
|
+
const contentsDir = path9.resolve(getAuntyRoot(), "templates/vanilla/base/contents");
|
|
1116
1119
|
await copyContents(contentsDir, baseDir);
|
|
1117
1120
|
await replaceInFiles(baseDir, ["index.html", "src/index.ts"], {
|
|
1118
1121
|
__PROJECT_NAME__: projectName,
|
|
@@ -1517,8 +1520,8 @@ async function run9(options = {}) {
|
|
|
1517
1520
|
const migrationSpinner = spin("Migrating configuration files...");
|
|
1518
1521
|
try {
|
|
1519
1522
|
const templateDir = path11.resolve(
|
|
1520
|
-
|
|
1521
|
-
"
|
|
1523
|
+
getAuntyRoot(),
|
|
1524
|
+
"templates/svelte/base/contents"
|
|
1522
1525
|
);
|
|
1523
1526
|
const filesToCopy = [
|
|
1524
1527
|
"vite.config.ts",
|
|
@@ -1572,8 +1575,8 @@ async function run9(options = {}) {
|
|
|
1572
1575
|
const pkgSpinner = spin("Updating package.json dependencies and scripts...");
|
|
1573
1576
|
try {
|
|
1574
1577
|
const templateDir = path11.resolve(
|
|
1575
|
-
|
|
1576
|
-
"
|
|
1578
|
+
getAuntyRoot(),
|
|
1579
|
+
"templates/svelte/base/contents"
|
|
1577
1580
|
);
|
|
1578
1581
|
const pkgPath2 = path11.join(baseDir, "package.json");
|
|
1579
1582
|
const pkg2 = await loadJson(pkgPath2);
|
package/dist/bin/commander.js
CHANGED
|
@@ -242,10 +242,13 @@ async function getGitUser() {
|
|
|
242
242
|
return null;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
+
function getAuntyRoot() {
|
|
246
|
+
return path5.resolve(import.meta.dirname, "../../");
|
|
247
|
+
}
|
|
245
248
|
async function installAunty(baseDir) {
|
|
246
249
|
const localDev = isLocalDevelopment();
|
|
247
250
|
let auntyDepValue = "";
|
|
248
|
-
const auntyRoot =
|
|
251
|
+
const auntyRoot = getAuntyRoot();
|
|
249
252
|
if (localDev) {
|
|
250
253
|
auntyDepValue = `file:${auntyRoot}`;
|
|
251
254
|
} else {
|
|
@@ -301,7 +304,7 @@ __export(init_exports, {
|
|
|
301
304
|
import path8 from "node:path";
|
|
302
305
|
import fs3 from "node:fs/promises";
|
|
303
306
|
async function init4({ projectName, baseDir }) {
|
|
304
|
-
const contentsDir = path8.resolve(
|
|
307
|
+
const contentsDir = path8.resolve(getAuntyRoot(), "templates/svelte/patch-builder/contents");
|
|
305
308
|
await copyContents(contentsDir, baseDir);
|
|
306
309
|
await replaceInFile(baseDir, "builder/index.html", {
|
|
307
310
|
__PROJECT_NAME__: projectName
|
|
@@ -1004,7 +1007,7 @@ import { multiselect, cancel as cancel3, isCancel as isCancel3 } from "@clack/pr
|
|
|
1004
1007
|
init_initHelpers();
|
|
1005
1008
|
import path6 from "node:path";
|
|
1006
1009
|
async function init({ projectName, baseDir }) {
|
|
1007
|
-
const contentsDir = path6.resolve(
|
|
1010
|
+
const contentsDir = path6.resolve(getAuntyRoot(), "templates/svelte/base/contents");
|
|
1008
1011
|
await copyContents(contentsDir, baseDir);
|
|
1009
1012
|
await replaceInFiles(
|
|
1010
1013
|
baseDir,
|
|
@@ -1040,7 +1043,7 @@ async function init2({ baseDir }) {
|
|
|
1040
1043
|
init_initHelpers();
|
|
1041
1044
|
import path7 from "node:path";
|
|
1042
1045
|
async function init3({ projectName, baseDir }) {
|
|
1043
|
-
const contentsDir = path7.resolve(
|
|
1046
|
+
const contentsDir = path7.resolve(getAuntyRoot(), "templates/svelte/patch-scrollyteller/contents");
|
|
1044
1047
|
await copyContents(contentsDir, baseDir);
|
|
1045
1048
|
await editPackageJson(baseDir, (pkg2) => {
|
|
1046
1049
|
pkg2.dependencies = pkg2.dependencies || {};
|
|
@@ -1097,7 +1100,7 @@ import { select as select2, confirm as confirm2, cancel as cancel4, isCancel as
|
|
|
1097
1100
|
init_initHelpers();
|
|
1098
1101
|
import path9 from "node:path";
|
|
1099
1102
|
async function init6({ projectName, baseDir }) {
|
|
1100
|
-
const contentsDir = path9.resolve(
|
|
1103
|
+
const contentsDir = path9.resolve(getAuntyRoot(), "templates/vanilla/base/contents");
|
|
1101
1104
|
await copyContents(contentsDir, baseDir);
|
|
1102
1105
|
await replaceInFiles(baseDir, ["index.html", "src/index.ts"], {
|
|
1103
1106
|
__PROJECT_NAME__: projectName,
|
|
@@ -1426,8 +1429,8 @@ async function run9(options = {}) {
|
|
|
1426
1429
|
const migrationSpinner = spin("Migrating configuration files...");
|
|
1427
1430
|
try {
|
|
1428
1431
|
const templateDir = path11.resolve(
|
|
1429
|
-
|
|
1430
|
-
"
|
|
1432
|
+
getAuntyRoot(),
|
|
1433
|
+
"templates/svelte/base/contents"
|
|
1431
1434
|
);
|
|
1432
1435
|
const filesToCopy = [
|
|
1433
1436
|
"vite.config.ts",
|
|
@@ -1481,8 +1484,8 @@ async function run9(options = {}) {
|
|
|
1481
1484
|
const pkgSpinner = spin("Updating package.json dependencies and scripts...");
|
|
1482
1485
|
try {
|
|
1483
1486
|
const templateDir = path11.resolve(
|
|
1484
|
-
|
|
1485
|
-
"
|
|
1487
|
+
getAuntyRoot(),
|
|
1488
|
+
"templates/svelte/base/contents"
|
|
1486
1489
|
);
|
|
1487
1490
|
const pkgPath2 = path11.join(baseDir, "package.json");
|
|
1488
1491
|
const pkg2 = await loadJson(pkgPath2);
|
|
@@ -46,6 +46,12 @@ export declare function getGitUser(): Promise<{
|
|
|
46
46
|
name: string;
|
|
47
47
|
email: string;
|
|
48
48
|
} | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the root directory of the aunty package.
|
|
51
|
+
* Resolves relative to the root since template scripts get bundled by esbuild
|
|
52
|
+
* into `dist/bin/commander.js`, altering their local directory context.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getAuntyRoot(): string;
|
|
49
55
|
/**
|
|
50
56
|
* Adds @abcnews/aunty to the package.json devDependencies of the target directory.
|
|
51
57
|
* Resolves to the local development path if running in local development mode,
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ import { $, glob } from "zx";
|
|
|
12
12
|
import { getHeader, spin } from "../../lib/terminal.ts";
|
|
13
13
|
import { findProjectDetails, loadJson } from "../../lib/util.ts";
|
|
14
14
|
import * as git from "../../lib/git.ts";
|
|
15
|
-
import { installAunty } from "../../lib/initHelpers.ts";
|
|
15
|
+
import { installAunty, getAuntyRoot } from "../../lib/initHelpers.ts";
|
|
16
16
|
|
|
17
17
|
interface MigrateOptions {
|
|
18
18
|
yes?: boolean;
|
|
@@ -176,8 +176,8 @@ export async function run(options: MigrateOptions = {}): Promise<number> {
|
|
|
176
176
|
const migrationSpinner = spin("Migrating configuration files...");
|
|
177
177
|
try {
|
|
178
178
|
const templateDir = path.resolve(
|
|
179
|
-
|
|
180
|
-
"
|
|
179
|
+
getAuntyRoot(),
|
|
180
|
+
"templates/svelte/base/contents",
|
|
181
181
|
);
|
|
182
182
|
|
|
183
183
|
// Copy Vite config files
|
|
@@ -251,8 +251,8 @@ export async function run(options: MigrateOptions = {}): Promise<number> {
|
|
|
251
251
|
const pkgSpinner = spin("Updating package.json dependencies and scripts...");
|
|
252
252
|
try {
|
|
253
253
|
const templateDir = path.resolve(
|
|
254
|
-
|
|
255
|
-
"
|
|
254
|
+
getAuntyRoot(),
|
|
255
|
+
"templates/svelte/base/contents",
|
|
256
256
|
);
|
|
257
257
|
const pkgPath = path.join(baseDir, "package.json");
|
|
258
258
|
const pkg = await loadJson<any>(pkgPath);
|
package/src/lib/initHelpers.ts
CHANGED
|
@@ -125,6 +125,15 @@ export async function getGitUser(): Promise<{
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Gets the root directory of the aunty package.
|
|
130
|
+
* Resolves relative to the root since template scripts get bundled by esbuild
|
|
131
|
+
* into `dist/bin/commander.js`, altering their local directory context.
|
|
132
|
+
*/
|
|
133
|
+
export function getAuntyRoot(): string {
|
|
134
|
+
return path.resolve(import.meta.dirname, "../../");
|
|
135
|
+
}
|
|
136
|
+
|
|
128
137
|
/**
|
|
129
138
|
* Adds @abcnews/aunty to the package.json devDependencies of the target directory.
|
|
130
139
|
* Resolves to the local development path if running in local development mode,
|
|
@@ -139,8 +148,7 @@ export async function installAunty(baseDir: string): Promise<void> {
|
|
|
139
148
|
const localDev = isLocalDevelopment();
|
|
140
149
|
let auntyDepValue = "";
|
|
141
150
|
|
|
142
|
-
|
|
143
|
-
const auntyRoot = path.resolve(import.meta.dirname, "../../");
|
|
151
|
+
const auntyRoot = getAuntyRoot();
|
|
144
152
|
|
|
145
153
|
if (localDev) {
|
|
146
154
|
auntyDepValue = `file:${auntyRoot}`;
|
|
@@ -6,7 +6,7 @@ import type { InitOptions } from "../../../src/commands/create/types.ts";
|
|
|
6
6
|
|
|
7
7
|
export async function init({ projectName, baseDir }: InitOptions) {
|
|
8
8
|
// Copy template to destination
|
|
9
|
-
const contentsDir = path.resolve(
|
|
9
|
+
const contentsDir = path.resolve(helpers.getAuntyRoot(), "templates/svelte/base/contents");
|
|
10
10
|
await helpers.copyContents(contentsDir, baseDir);
|
|
11
11
|
|
|
12
12
|
// String replacements
|
|
@@ -8,7 +8,7 @@ import fs from "node:fs/promises";
|
|
|
8
8
|
*/
|
|
9
9
|
export async function init({ projectName, baseDir }: InitOptions) {
|
|
10
10
|
// Copy patch-builder files to target
|
|
11
|
-
const contentsDir = path.resolve(
|
|
11
|
+
const contentsDir = path.resolve(helpers.getAuntyRoot(), "templates/svelte/patch-builder/contents");
|
|
12
12
|
await helpers.copyContents(contentsDir, baseDir);
|
|
13
13
|
|
|
14
14
|
// Update builder/index.html with project name
|
|
@@ -4,7 +4,7 @@ import type { InitOptions } from "../../../src/commands/create/types.ts";
|
|
|
4
4
|
|
|
5
5
|
export async function init({ projectName, baseDir }: InitOptions) {
|
|
6
6
|
// Copy template to destination
|
|
7
|
-
const contentsDir = path.resolve(
|
|
7
|
+
const contentsDir = path.resolve(helpers.getAuntyRoot(), "templates/svelte/patch-scrollyteller/contents");
|
|
8
8
|
await helpers.copyContents(contentsDir, baseDir);
|
|
9
9
|
|
|
10
10
|
await helpers.editPackageJson(baseDir, (pkg) => {
|
|
@@ -5,7 +5,7 @@ import type { InitOptions } from "../../../src/commands/create/types.ts";
|
|
|
5
5
|
|
|
6
6
|
export async function init({ projectName, baseDir }: InitOptions) {
|
|
7
7
|
// Copy template to destination
|
|
8
|
-
const contentsDir = path.resolve(
|
|
8
|
+
const contentsDir = path.resolve(helpers.getAuntyRoot(), "templates/vanilla/base/contents");
|
|
9
9
|
await helpers.copyContents(contentsDir, baseDir);
|
|
10
10
|
|
|
11
11
|
// String replacements
|