@nshiab/setup-data-project 1.0.39 → 2.0.0
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/README.md +11 -5
- package/esm/helpers/createFolderStructure.d.ts.map +1 -1
- package/esm/helpers/createFolderStructure.js +4 -5
- package/esm/helpers/ensureAgents.d.ts.map +1 -1
- package/esm/helpers/ensureAgents.js +3 -1
- package/esm/helpers/ensureManagedSection.d.ts.map +1 -1
- package/esm/helpers/ensureManagedSection.js +5 -2
- package/esm/helpers/ensureReadme.d.ts.map +1 -1
- package/esm/helpers/ensureReadme.js +7 -3
- package/esm/helpers/getProjectTasks.js +1 -1
- package/esm/helpers/installPackagesAndFetchDocs.d.ts.map +1 -1
- package/esm/helpers/installPackagesAndFetchDocs.js +10 -1
- package/esm/helpers/projectManifest.d.ts.map +1 -1
- package/esm/helpers/projectManifest.js +1 -1
- package/package.json +2 -2
- package/script/helpers/createFolderStructure.d.ts.map +1 -1
- package/script/helpers/createFolderStructure.js +4 -5
- package/script/helpers/ensureAgents.d.ts.map +1 -1
- package/script/helpers/ensureAgents.js +3 -1
- package/script/helpers/ensureManagedSection.d.ts.map +1 -1
- package/script/helpers/ensureManagedSection.js +5 -2
- package/script/helpers/ensureReadme.d.ts.map +1 -1
- package/script/helpers/ensureReadme.js +7 -3
- package/script/helpers/getProjectTasks.js +1 -1
- package/script/helpers/installPackagesAndFetchDocs.d.ts.map +1 -1
- package/script/helpers/installPackagesAndFetchDocs.js +10 -1
- package/script/helpers/projectManifest.d.ts.map +1 -1
- package/script/helpers/projectManifest.js +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ configurations, and documentation.
|
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
7
|
# Deno
|
|
8
|
-
deno run -A jsr:@nshiab/setup-data-project
|
|
8
|
+
deno run --min-dep-age=0 -A jsr:@nshiab/setup-data-project
|
|
9
9
|
|
|
10
10
|
# Node
|
|
11
11
|
npx @nshiab/setup-data-project
|
|
@@ -14,12 +14,18 @@ npx @nshiab/setup-data-project
|
|
|
14
14
|
bunx @nshiab/setup-data-project
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
The Deno dependency-age bypass is temporary while the 2.0 dependencies are newly
|
|
18
|
+
published. It is tracked for removal in
|
|
19
|
+
[issue #15](https://github.com/nshiab/setup-data-project/issues/15).
|
|
20
|
+
|
|
17
21
|
- Creates a standardized folder structure.
|
|
18
22
|
- Ensures necessary files like `.env`, `.gitignore`, and `README.md` exist.
|
|
19
|
-
-
|
|
20
|
-
[simple-data-analysis](https://github.com/nshiab/simple-data-analysis
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
- Lets you choose between
|
|
24
|
+
[simple-data-analysis-core](https://github.com/nshiab/simple-data-analysis-core),
|
|
25
|
+
the full
|
|
26
|
+
[simple-data-analysis](https://github.com/nshiab/simple-data-analysis/)
|
|
27
|
+
package, and [journalism](https://github.com/nshiab/journalism) libraries,
|
|
28
|
+
then fetches their documentation for LLM use.
|
|
23
29
|
- Updates project configuration (e.g., `deno.json` or `package.json`) with
|
|
24
30
|
relevant tasks.
|
|
25
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFolderStructure.d.ts","sourceRoot":"","sources":["../../src/helpers/createFolderStructure.ts"],"names":[],"mappings":"AAIA,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"createFolderStructure.d.ts","sourceRoot":"","sources":["../../src/helpers/createFolderStructure.ts"],"names":[],"mappings":"AAIA,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,UA6C/D"}
|
|
@@ -25,12 +25,11 @@ export function createFolderStructure(selectedPackages) {
|
|
|
25
25
|
const sdb = new SimpleDB();
|
|
26
26
|
const table = sdb.newTable();
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
await table
|
|
29
|
+
.loadArray([{ message: "Hello simple-data-analysis!" }])
|
|
30
|
+
.log();
|
|
30
31
|
|
|
31
|
-
await
|
|
32
|
-
|
|
33
|
-
await sdb.done();
|
|
32
|
+
await sdb.close();
|
|
34
33
|
`;
|
|
35
34
|
}
|
|
36
35
|
if (lstatSync(mainTsPath, { throwIfNoEntry: false }) === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureAgents.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureAgents.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAA6B,
|
|
1
|
+
{"version":3,"file":"ensureAgents.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureAgents.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAA6B,QAmJvD"}
|
|
@@ -122,7 +122,9 @@ ${journalismFunctions}`;
|
|
|
122
122
|
}
|
|
123
123
|
if (sdaClassesAndMethods !== "") {
|
|
124
124
|
content += `
|
|
125
|
-
Here are the classes and their methods available in the "${sdaLibraryName}" library. If one of the classes or methods might be relevant, read the complete documentation at "${sdaDocsPath}" to properly use it.
|
|
125
|
+
Here are the classes and their methods available in the "${sdaLibraryName}" library. If one of the classes or methods might be relevant, read the complete documentation at "${sdaDocsPath}" to properly use it.
|
|
126
|
+
|
|
127
|
+
Most data-loading and transformation methods are synchronous, chainable builders. Await the final asynchronous observer or export method, such as \`log()\`, \`getData()\`, or \`writeData()\`, to execute the queued operations. If a chain ends without an observer, call \`run()\`. Always call \`await sdb.close()\` when the database is no longer needed. Methods that return an answer or export to an external service can be asynchronous, so verify their documentation before calling them.
|
|
126
128
|
${sdaClassesAndMethods}`;
|
|
127
129
|
}
|
|
128
130
|
const status = ensureManagedSection({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureManagedSection.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureManagedSection.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ensureManagedSection.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureManagedSection.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,iBAAiB,CAwCzD"}
|
|
@@ -8,7 +8,7 @@ export function ensureManagedSection(options) {
|
|
|
8
8
|
? `${startMarker}\n${endMarker}`
|
|
9
9
|
: `${startMarker}\n${trimmedContent}\n${endMarker}`;
|
|
10
10
|
if (!existsSync(options.path)) {
|
|
11
|
-
writeFileSync(options.path, options.createContent(section));
|
|
11
|
+
writeFileSync(options.path, ensureFinalNewline(options.createContent(section)));
|
|
12
12
|
return "created";
|
|
13
13
|
}
|
|
14
14
|
const currentContent = readFileSync(options.path, "utf-8");
|
|
@@ -25,6 +25,9 @@ export function ensureManagedSection(options) {
|
|
|
25
25
|
if (nextContent === currentContent) {
|
|
26
26
|
return "unchanged";
|
|
27
27
|
}
|
|
28
|
-
writeFileSync(options.path, nextContent);
|
|
28
|
+
writeFileSync(options.path, ensureFinalNewline(nextContent));
|
|
29
29
|
return "updated";
|
|
30
30
|
}
|
|
31
|
+
function ensureFinalNewline(content) {
|
|
32
|
+
return content.endsWith("\n") ? content : content + "\n";
|
|
33
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureReadme.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureReadme.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAAO,
|
|
1
|
+
{"version":3,"file":"ensureReadme.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureReadme.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAAO,QAsEjC"}
|
|
@@ -10,17 +10,21 @@ export function ensureReadme(runtime, installedPackages = []) {
|
|
|
10
10
|
runCommand = "bun run";
|
|
11
11
|
}
|
|
12
12
|
const installedPackageConfigs = getInstalledPackageConfigs(installedPackages);
|
|
13
|
-
const
|
|
13
|
+
const hasSdaCore = installedPackageConfigs.some((pkg) => pkg.value === "@nshiab/simple-data-analysis-core");
|
|
14
|
+
const hasFullSda = installedPackageConfigs.some((pkg) => pkg.value === "@nshiab/simple-data-analysis");
|
|
14
15
|
const hasJournalism = installedPackageConfigs.some((pkg) => pkg.type === "journalism");
|
|
15
16
|
const libraryLinks = [
|
|
16
|
-
|
|
17
|
+
hasSdaCore
|
|
18
|
+
? "[simple-data-analysis-core](https://github.com/nshiab/simple-data-analysis-core)"
|
|
19
|
+
: "",
|
|
20
|
+
hasFullSda
|
|
17
21
|
? "[simple-data-analysis](https://github.com/nshiab/simple-data-analysis)"
|
|
18
22
|
: "",
|
|
19
23
|
hasJournalism ? "[journalism](https://github.com/nshiab/journalism)" : "",
|
|
20
24
|
].filter(Boolean);
|
|
21
25
|
const librarySection = libraryLinks.length === 0
|
|
22
26
|
? ""
|
|
23
|
-
: `It has installed ${libraryLinks.join(" and ")} libraries, along with
|
|
27
|
+
: `It has installed ${libraryLinks.join(" and ")} ${libraryLinks.length === 1 ? "library" : "libraries"}, along with
|
|
24
28
|
up-to-date documentation and AI agent instructions.`;
|
|
25
29
|
const status = ensureManagedSection({
|
|
26
30
|
path: "README.md",
|
|
@@ -8,7 +8,7 @@ export function getProjectTasks() {
|
|
|
8
8
|
? "bun run --watch sda/main.ts"
|
|
9
9
|
: "node --env-file-if-exists=.env --watch --experimental-strip-types sda/main.ts",
|
|
10
10
|
"all-tests": runtime === "deno"
|
|
11
|
-
? "deno fmt --check && deno lint && deno check sda/main.ts && deno test -A"
|
|
11
|
+
? "deno fmt --check sda && deno lint && deno check sda/main.ts && deno test -A --permit-no-files"
|
|
12
12
|
: runtime === "bun"
|
|
13
13
|
? "bun test --pass-with-no-tests"
|
|
14
14
|
: "node --env-file-if-exists=.env --experimental-strip-types --test",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installPackagesAndFetchDocs.d.ts","sourceRoot":"","sources":["../../src/helpers/installPackagesAndFetchDocs.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;CAEzB,CAAC;
|
|
1
|
+
{"version":3,"file":"installPackagesAndFetchDocs.d.ts","sourceRoot":"","sources":["../../src/helpers/installPackagesAndFetchDocs.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;CAEzB,CAAC;AASF,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4C7B;AAED,wBAAsB,2BAA2B,CAC/C,gBAAgB,EAAE,MAAM,EAAE,EAC1B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgExB"}
|
|
@@ -6,6 +6,12 @@ import { getRuntime } from "./getRuntime.js";
|
|
|
6
6
|
export const commandRunner = {
|
|
7
7
|
exec: childProcess.exec,
|
|
8
8
|
};
|
|
9
|
+
// Temporary: remove this bypass after the 2.0 release window.
|
|
10
|
+
// https://github.com/nshiab/setup-data-project/issues/15
|
|
11
|
+
const PACKAGES_WITH_FRESH_DENO_RELEASES = new Set([
|
|
12
|
+
"@nshiab/simple-data-analysis-core",
|
|
13
|
+
"@nshiab/simple-data-analysis",
|
|
14
|
+
]);
|
|
9
15
|
export async function fetchPackageDocs(pkg, options = {}) {
|
|
10
16
|
if (!existsSync("docs")) {
|
|
11
17
|
mkdirSync("docs");
|
|
@@ -60,8 +66,11 @@ export async function installPackagesAndFetchDocs(selectedPackages, options = {}
|
|
|
60
66
|
}
|
|
61
67
|
for (const p of pkgsToInstall) {
|
|
62
68
|
const isObservablePlot = p === "@observablehq/plot";
|
|
69
|
+
const minimumDependencyAgeOption = PACKAGES_WITH_FRESH_DENO_RELEASES.has(p) ? " --min-dep-age=0" : "";
|
|
63
70
|
const installCmd = runtime === "deno"
|
|
64
|
-
? (isObservablePlot
|
|
71
|
+
? (isObservablePlot
|
|
72
|
+
? "deno add npm:" + p
|
|
73
|
+
: "deno add" + minimumDependencyAgeOption + " jsr:" + p)
|
|
65
74
|
: runtime === "bun"
|
|
66
75
|
? "bun add " + p
|
|
67
76
|
: "npm install " + p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectManifest.d.ts","sourceRoot":"","sources":["../../src/helpers/projectManifest.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAGvC,qBAAa,eAAe;;IAM1B,OAAO;IAYP,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe;IA6B9C,MAAM,IAAI,IAAI;IAId,oBAAoB,IAAI,MAAM,EAAE;IAgBhC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"projectManifest.d.ts","sourceRoot":"","sources":["../../src/helpers/projectManifest.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAGvC,qBAAa,eAAe;;IAM1B,OAAO;IAYP,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe;IA6B9C,MAAM,IAAI,IAAI;IAId,oBAAoB,IAAI,MAAM,EAAE;IAgBhC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;CAcjD"}
|
|
@@ -54,7 +54,7 @@ export class ProjectManifest {
|
|
|
54
54
|
? currentTasks
|
|
55
55
|
: {};
|
|
56
56
|
__classPrivateFieldGet(this, _ProjectManifest_config, "f")[__classPrivateFieldGet(this, _ProjectManifest_taskKey, "f")] = { ...existingTasks, ...tasks };
|
|
57
|
-
writeFileSync(__classPrivateFieldGet(this, _ProjectManifest_path, "f"), JSON.stringify(__classPrivateFieldGet(this, _ProjectManifest_config, "f"), null, 2), "utf-8");
|
|
57
|
+
writeFileSync(__classPrivateFieldGet(this, _ProjectManifest_path, "f"), JSON.stringify(__classPrivateFieldGet(this, _ProjectManifest_config, "f"), null, 2) + "\n", "utf-8");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
_ProjectManifest_path = new WeakMap(), _ProjectManifest_taskKey = new WeakMap(), _ProjectManifest_dependencyKeys = new WeakMap(), _ProjectManifest_config = new WeakMap();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nshiab/setup-data-project",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Quickly kick off
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Quickly kick off a project using simple-data-analysis-core, simple-data-analysis, and journalism libraries.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/nshiab/setup-data-project"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFolderStructure.d.ts","sourceRoot":"","sources":["../../src/helpers/createFolderStructure.ts"],"names":[],"mappings":"AAIA,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"createFolderStructure.d.ts","sourceRoot":"","sources":["../../src/helpers/createFolderStructure.ts"],"names":[],"mappings":"AAIA,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,UA6C/D"}
|
|
@@ -28,12 +28,11 @@ function createFolderStructure(selectedPackages) {
|
|
|
28
28
|
const sdb = new SimpleDB();
|
|
29
29
|
const table = sdb.newTable();
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
await table
|
|
32
|
+
.loadArray([{ message: "Hello simple-data-analysis!" }])
|
|
33
|
+
.log();
|
|
33
34
|
|
|
34
|
-
await
|
|
35
|
-
|
|
36
|
-
await sdb.done();
|
|
35
|
+
await sdb.close();
|
|
37
36
|
`;
|
|
38
37
|
}
|
|
39
38
|
if ((0, node_fs_1.lstatSync)(mainTsPath, { throwIfNoEntry: false }) === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureAgents.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureAgents.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAA6B,
|
|
1
|
+
{"version":3,"file":"ensureAgents.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureAgents.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAA6B,QAmJvD"}
|
|
@@ -125,7 +125,9 @@ ${journalismFunctions}`;
|
|
|
125
125
|
}
|
|
126
126
|
if (sdaClassesAndMethods !== "") {
|
|
127
127
|
content += `
|
|
128
|
-
Here are the classes and their methods available in the "${sdaLibraryName}" library. If one of the classes or methods might be relevant, read the complete documentation at "${sdaDocsPath}" to properly use it.
|
|
128
|
+
Here are the classes and their methods available in the "${sdaLibraryName}" library. If one of the classes or methods might be relevant, read the complete documentation at "${sdaDocsPath}" to properly use it.
|
|
129
|
+
|
|
130
|
+
Most data-loading and transformation methods are synchronous, chainable builders. Await the final asynchronous observer or export method, such as \`log()\`, \`getData()\`, or \`writeData()\`, to execute the queued operations. If a chain ends without an observer, call \`run()\`. Always call \`await sdb.close()\` when the database is no longer needed. Methods that return an answer or export to an external service can be asynchronous, so verify their documentation before calling them.
|
|
129
131
|
${sdaClassesAndMethods}`;
|
|
130
132
|
}
|
|
131
133
|
const status = (0, ensureManagedSection_js_1.ensureManagedSection)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureManagedSection.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureManagedSection.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ensureManagedSection.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureManagedSection.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,iBAAiB,CAwCzD"}
|
|
@@ -11,7 +11,7 @@ function ensureManagedSection(options) {
|
|
|
11
11
|
? `${startMarker}\n${endMarker}`
|
|
12
12
|
: `${startMarker}\n${trimmedContent}\n${endMarker}`;
|
|
13
13
|
if (!(0, node_fs_1.existsSync)(options.path)) {
|
|
14
|
-
(0, node_fs_1.writeFileSync)(options.path, options.createContent(section));
|
|
14
|
+
(0, node_fs_1.writeFileSync)(options.path, ensureFinalNewline(options.createContent(section)));
|
|
15
15
|
return "created";
|
|
16
16
|
}
|
|
17
17
|
const currentContent = (0, node_fs_1.readFileSync)(options.path, "utf-8");
|
|
@@ -28,6 +28,9 @@ function ensureManagedSection(options) {
|
|
|
28
28
|
if (nextContent === currentContent) {
|
|
29
29
|
return "unchanged";
|
|
30
30
|
}
|
|
31
|
-
(0, node_fs_1.writeFileSync)(options.path, nextContent);
|
|
31
|
+
(0, node_fs_1.writeFileSync)(options.path, ensureFinalNewline(nextContent));
|
|
32
32
|
return "updated";
|
|
33
33
|
}
|
|
34
|
+
function ensureFinalNewline(content) {
|
|
35
|
+
return content.endsWith("\n") ? content : content + "\n";
|
|
36
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureReadme.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureReadme.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAAO,
|
|
1
|
+
{"version":3,"file":"ensureReadme.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureReadme.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAAO,QAsEjC"}
|
|
@@ -13,17 +13,21 @@ function ensureReadme(runtime, installedPackages = []) {
|
|
|
13
13
|
runCommand = "bun run";
|
|
14
14
|
}
|
|
15
15
|
const installedPackageConfigs = (0, packageRegistry_js_1.getInstalledPackageConfigs)(installedPackages);
|
|
16
|
-
const
|
|
16
|
+
const hasSdaCore = installedPackageConfigs.some((pkg) => pkg.value === "@nshiab/simple-data-analysis-core");
|
|
17
|
+
const hasFullSda = installedPackageConfigs.some((pkg) => pkg.value === "@nshiab/simple-data-analysis");
|
|
17
18
|
const hasJournalism = installedPackageConfigs.some((pkg) => pkg.type === "journalism");
|
|
18
19
|
const libraryLinks = [
|
|
19
|
-
|
|
20
|
+
hasSdaCore
|
|
21
|
+
? "[simple-data-analysis-core](https://github.com/nshiab/simple-data-analysis-core)"
|
|
22
|
+
: "",
|
|
23
|
+
hasFullSda
|
|
20
24
|
? "[simple-data-analysis](https://github.com/nshiab/simple-data-analysis)"
|
|
21
25
|
: "",
|
|
22
26
|
hasJournalism ? "[journalism](https://github.com/nshiab/journalism)" : "",
|
|
23
27
|
].filter(Boolean);
|
|
24
28
|
const librarySection = libraryLinks.length === 0
|
|
25
29
|
? ""
|
|
26
|
-
: `It has installed ${libraryLinks.join(" and ")} libraries, along with
|
|
30
|
+
: `It has installed ${libraryLinks.join(" and ")} ${libraryLinks.length === 1 ? "library" : "libraries"}, along with
|
|
27
31
|
up-to-date documentation and AI agent instructions.`;
|
|
28
32
|
const status = (0, ensureManagedSection_js_1.ensureManagedSection)({
|
|
29
33
|
path: "README.md",
|
|
@@ -11,7 +11,7 @@ function getProjectTasks() {
|
|
|
11
11
|
? "bun run --watch sda/main.ts"
|
|
12
12
|
: "node --env-file-if-exists=.env --watch --experimental-strip-types sda/main.ts",
|
|
13
13
|
"all-tests": runtime === "deno"
|
|
14
|
-
? "deno fmt --check && deno lint && deno check sda/main.ts && deno test -A"
|
|
14
|
+
? "deno fmt --check sda && deno lint && deno check sda/main.ts && deno test -A --permit-no-files"
|
|
15
15
|
: runtime === "bun"
|
|
16
16
|
? "bun test --pass-with-no-tests"
|
|
17
17
|
: "node --env-file-if-exists=.env --experimental-strip-types --test",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installPackagesAndFetchDocs.d.ts","sourceRoot":"","sources":["../../src/helpers/installPackagesAndFetchDocs.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;CAEzB,CAAC;
|
|
1
|
+
{"version":3,"file":"installPackagesAndFetchDocs.d.ts","sourceRoot":"","sources":["../../src/helpers/installPackagesAndFetchDocs.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;CAEzB,CAAC;AASF,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4C7B;AAED,wBAAsB,2BAA2B,CAC/C,gBAAgB,EAAE,MAAM,EAAE,EAC1B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgExB"}
|
|
@@ -44,6 +44,12 @@ const getRuntime_js_1 = require("./getRuntime.js");
|
|
|
44
44
|
exports.commandRunner = {
|
|
45
45
|
exec: childProcess.exec,
|
|
46
46
|
};
|
|
47
|
+
// Temporary: remove this bypass after the 2.0 release window.
|
|
48
|
+
// https://github.com/nshiab/setup-data-project/issues/15
|
|
49
|
+
const PACKAGES_WITH_FRESH_DENO_RELEASES = new Set([
|
|
50
|
+
"@nshiab/simple-data-analysis-core",
|
|
51
|
+
"@nshiab/simple-data-analysis",
|
|
52
|
+
]);
|
|
47
53
|
async function fetchPackageDocs(pkg, options = {}) {
|
|
48
54
|
if (!(0, node_fs_1.existsSync)("docs")) {
|
|
49
55
|
(0, node_fs_1.mkdirSync)("docs");
|
|
@@ -98,8 +104,11 @@ async function installPackagesAndFetchDocs(selectedPackages, options = {}) {
|
|
|
98
104
|
}
|
|
99
105
|
for (const p of pkgsToInstall) {
|
|
100
106
|
const isObservablePlot = p === "@observablehq/plot";
|
|
107
|
+
const minimumDependencyAgeOption = PACKAGES_WITH_FRESH_DENO_RELEASES.has(p) ? " --min-dep-age=0" : "";
|
|
101
108
|
const installCmd = runtime === "deno"
|
|
102
|
-
? (isObservablePlot
|
|
109
|
+
? (isObservablePlot
|
|
110
|
+
? "deno add npm:" + p
|
|
111
|
+
: "deno add" + minimumDependencyAgeOption + " jsr:" + p)
|
|
103
112
|
: runtime === "bun"
|
|
104
113
|
? "bun add " + p
|
|
105
114
|
: "npm install " + p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectManifest.d.ts","sourceRoot":"","sources":["../../src/helpers/projectManifest.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAGvC,qBAAa,eAAe;;IAM1B,OAAO;IAYP,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe;IA6B9C,MAAM,IAAI,IAAI;IAId,oBAAoB,IAAI,MAAM,EAAE;IAgBhC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"projectManifest.d.ts","sourceRoot":"","sources":["../../src/helpers/projectManifest.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAGvC,qBAAa,eAAe;;IAM1B,OAAO;IAYP,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe;IA6B9C,MAAM,IAAI,IAAI;IAId,oBAAoB,IAAI,MAAM,EAAE;IAgBhC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;CAcjD"}
|
|
@@ -57,7 +57,7 @@ class ProjectManifest {
|
|
|
57
57
|
? currentTasks
|
|
58
58
|
: {};
|
|
59
59
|
__classPrivateFieldGet(this, _ProjectManifest_config, "f")[__classPrivateFieldGet(this, _ProjectManifest_taskKey, "f")] = { ...existingTasks, ...tasks };
|
|
60
|
-
(0, node_fs_1.writeFileSync)(__classPrivateFieldGet(this, _ProjectManifest_path, "f"), JSON.stringify(__classPrivateFieldGet(this, _ProjectManifest_config, "f"), null, 2), "utf-8");
|
|
60
|
+
(0, node_fs_1.writeFileSync)(__classPrivateFieldGet(this, _ProjectManifest_path, "f"), JSON.stringify(__classPrivateFieldGet(this, _ProjectManifest_config, "f"), null, 2) + "\n", "utf-8");
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
exports.ProjectManifest = ProjectManifest;
|