@datapos/datapos-development 0.3.17 → 0.3.20

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "explorer.fileNesting.enabled": true,
3
+ "explorer.fileNesting.patterns": {
4
+ "package.json": ".gitignore, .prettier*, eslint*, package-lock.json",
5
+ "README.md": "LICENSE, LICENSES.json"
6
+ }
7
+ }
package/LICENSES.json CHANGED
@@ -1 +1 @@
1
- {}
1
+ []
package/README.md CHANGED
@@ -1,66 +1,64 @@
1
- # DataPos Development Library
1
+ # Data Positioning Development Library
2
2
 
3
- A library of JavaScript operations for managing the DataPos repositories.
3
+ [![npm version](https://img.shields.io/npm/v/@datapos/datapos-shared.svg)](https://www.npmjs.com/package/@datapos/datapos-shared)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
5
+ [![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](#)
6
+
7
+ A library of JavaScript operations for managing the Data Positioning repositories.
4
8
 
5
9
  ## Requirements
6
10
 
7
11
  Ensure your environment meets the following prerequisites before using this library:
8
12
 
9
- - **Node.js** version `>=18.0.0`
10
- - **npm** version `>=9.0.0`
11
- - A Unix-like shell (for command shortcuts, e.g., `bash`, `zsh`, or Git Bash on Windows)
12
- - Access to the [npm registry](https://www.npmjs.com/) and [GitHub](https://github.com/) for publishing and syncing
13
+ - **Node.js** version `>=18.0.0`,
14
+ - **npm** version `>=9.0.0`,
15
+ - A Unix-like shell (for command shortcuts, e.g., `bash`, `zsh`, or Git Bash on Windows),
16
+ - Access to the [npm registry](https://www.npmjs.com/) and [GitHub](https://github.com/) for publishing and syncing.
13
17
 
14
18
  ## Installation
15
19
 
16
- ```
17
- npm install -D @datapos/datapos-development
18
- ```
19
-
20
- ## Dependencies
21
-
22
- | Name | Use | References |
23
- | -------- | --- | ------------------ |
24
- | eslint | dev | [GitHub]() [NPM]() |
25
- | nanoid | dev | [GitHub]() [NPM]() |
26
- | prettier | dev | [GitHub]() [NPM]() |
27
- | run | dev | [GitHub]() [NPM]() |
20
+ Install as a development (dev) dependency:
28
21
 
29
- Refer to package.json and LICENSES.json for detailed versions and licenses.
22
+ ```bash
23
+ npm install --save-dev @datapos/datapos-development
24
+ ```
30
25
 
31
26
  ## Operations
32
27
 
33
28
  The 'index.js' file exposes the following operations:
34
29
 
35
- | Name | Notes |
36
- | ------------------------- | ----------------------------------------------------------------- |
37
- | buildConfig | Build the config.json file for the repository. |
38
- | buildPublicDirectoryIndex | Build an index for the repositories public directory. |
39
- | bumpVersion | Bump the repositories version number. |
40
- | clearDirectory | Clear the specified directory. |
41
- | sendDeploymentNotice | Send a deployment notice fro the repository. |
42
- | syncWithGitHub | Synchronise the local repository with the main GitHub repository. |
43
- | uploadDirectoryToR2 | Upload a directory to Cloudflare R2 storage. |
44
- | uploadModuleConfig | |
45
- | uploadModuleToR2 | Upload a module to Cloudflare R2 storage. |
30
+ | Name | Notes |
31
+ | ------------------------- | ------------------------------------------------------------------------ |
32
+ | buildConfig | Build the config.json file for the repository. |
33
+ | buildPublicDirectoryIndex | Build an index for the repositories public directory. |
34
+ | bumpVersion | Bump the repositories version number. |
35
+ | clearDirectory | Clear the specified directory. |
36
+ | sendDeploymentNotice | Send a deployment notice for the repository. |
37
+ | syncWithGitHub | Synchronise the local repository with the main GitHub repository. |
38
+ | uploadDirectoryToR2 | Upload a directory to Cloudflare R2 storage. |
39
+ | uploadModuleConfig | Upload a modules configuration to the Cloudflare `state` durable object. |
40
+ | uploadModuleToR2 | Upload a module to Cloudflare R2 storage. |
46
41
 
47
42
  ## Repository Management Commands
48
43
 
49
- The following list details the repository management commands implemented by this project:
50
-
51
- | Name | Key Code | Notes |
52
- | ------------------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
53
- | audit | alt+ctrl+shift+a | Use [npm audit](https://docs.npmjs.com/cli/v8/commands/npm-audit) to audit the project's dependencies for known security vulnerabilities. |
54
- | build | alt+ctrl+shift+b | \*** NOT IMPLEMENTED \*** |
55
- | bumpVersion | | |
56
- | check | alt+ctrl+shift+c | Use [npx npm-check-updates](https://github.com/raineorshine/npm-check-updates) and [npm outdated](https://docs.npmjs.com/cli/v8/commands/npm-audit) to list the dependencies in the project that are outdated. |
57
- | document | alt+ctrl+shift+d | Use [npm-license-crawler](https://www.npmjs.com/package/npm-license-crawler) to identify the licenses of the project's direct production dependencies. |
58
- | format | alt+ctrl+shift+f | Use [prettier](https://prettier.io/) to format the code. |
59
- | lint | alt+ctrl+shift+l | Use [eslint](https://eslint.org/) to check the code for potential errors and enforce coding styles. |
60
- | publishToNPM | alt+ctrl+shift+n | Use [npm publish](https://docs.npmjs.com/cli/v8/commands/npm-publish) to publish the package to the [npm](https://www.npmjs.com/) registry. This action will publish the last synchronised version. |
61
- | release | alt+ctrl+shift+r | Synchronise the local repository with the main GitHub repository and publish the package to the [npm](https://www.npmjs.com/) registry. |
62
- | syncWithGitHub | alt+ctrl+shift+s | Synchronise the local repository with the main GitHub repository. |
63
- | test | alt+ctrl+shift+t | \*** NOT IMPLEMENTED \*** |
64
- | updateDependencies | alt+ctrl+shift+u | \*** NOT IMPLEMENTED \*** |
65
-
66
- For more details, please refer to the scripts section of the 'package.json' file in this project.
44
+ The table below lists the repository management commands available in this project.
45
+ For detailed implementation, see the `scripts` section in `package.json`.
46
+
47
+ | Name | Key Code | Notes |
48
+ | ------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------- |
49
+ | audit | alt+ctrl+shift+a | Audit the project's dependencies for known security vulnerabilities. |
50
+ | build | alt+ctrl+shift+b | NOT implemented. |
51
+ | check | alt+ctrl+shift+c | List outdated dependencies. |
52
+ | document | alt+ctrl+shift+d | Identify licenses of the project's production and peer dependencies. See [LICENSES.json](./LICENSES.json). |
53
+ | format | alt+ctrl+shift+f | Enforce formatting style rules. |
54
+ | lint | alt+ctrl+shift+l | Check the code for errors and enforce coding style rules. |
55
+ | release | alt+ctrl+shift+r | Bump version, synchronise local repository with the main GitHub repository and publish to npm. |
56
+ | syncWithGitHub | alt+ctrl+shift+s | Bump version and synchronise local repository with the main GitHub repository. |
57
+ | test | alt+ctrl+shift+t | NOT implemented. |
58
+ | updateDependencies | alt+ctrl+shift+u | NOT implemented. |
59
+
60
+ ## License
61
+
62
+ [MIT](./LICENSE) © 2026 Data Positioning Pty Ltd
63
+
64
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdata-positioning%2Fdatapos-development.svg?type=large&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdata-positioning%2Fdatapos-development?ref=badge_large&issueType=license)
package/index.js CHANGED
@@ -1,19 +1,19 @@
1
- // Dependencies - Vendor
1
+ // Dependencies
2
2
  const fs = require('fs').promises;
3
3
  const { nanoid } = require('nanoid');
4
4
 
5
- // Dependencies - Vendor (Promisify Exec)
5
+ // Dependencies - Promisify exec.
6
6
  const util = require('util');
7
7
  const exec = util.promisify(require('child_process').exec);
8
8
 
9
- // Operations - Build Configuration
9
+ // Operations - Build configuration.
10
10
  async function buildConfig(directoryPath) {
11
11
  const configJSON = await readJSONFile(`${directoryPath || ''}config.json`);
12
12
  const packageJSON = await readJSONFile('package.json');
13
13
  await fs.writeFile(`${directoryPath || ''}config.json`, JSON.stringify({ ...configJSON, id: packageJSON.name, version: packageJSON.version }, undefined, 4));
14
14
  }
15
15
 
16
- // Operations - Build Public Directory Index
16
+ // Operations - Build public directory index.
17
17
  async function buildPublicDirectoryIndex(id) {
18
18
  const index = {};
19
19
 
@@ -50,7 +50,7 @@ async function buildPublicDirectoryIndex(id) {
50
50
  });
51
51
  }
52
52
 
53
- // Operations - Bump Version
53
+ // Operations - Bump version.
54
54
  async function bumpVersion() {
55
55
  const packageJSON = await readJSONFile('package.json');
56
56
  const versionSegments = packageJSON.version.split('.');
@@ -59,7 +59,7 @@ async function bumpVersion() {
59
59
  console.log(`Bumped to version ${packageJSON.version}.`);
60
60
  }
61
61
 
62
- // Operations - Clear Directory
62
+ // Operations - Clear directory.
63
63
  async function clearDirectory(directoryPath) {
64
64
  for (const itemName of await fs.readdir(directoryPath)) {
65
65
  const itemPath = `${directoryPath}/${itemName}`;
@@ -76,9 +76,9 @@ async function clearDirectory(directoryPath) {
76
76
  }
77
77
  }
78
78
 
79
- // Operations - Send Deployment Notice
79
+ // Operations - Send deployment notice.
80
80
  async function sendDeploymentNotice() {
81
- const configJSON = await readJSONFile('src/config.json');
81
+ const configJSON = await readJSONFile('config.json');
82
82
  const options = {
83
83
  body: JSON.stringify(configJSON),
84
84
  headers: { 'Content-Type': 'application/json' },
@@ -88,7 +88,7 @@ async function sendDeploymentNotice() {
88
88
  if (!response.ok) console.log(await response.text());
89
89
  }
90
90
 
91
- // UtilitiesOperations - Sync with Github
91
+ // UtilitiesOperations - Sync with GitHub.
92
92
  async function syncWithGitHub() {
93
93
  const packageJSON = await readJSONFile('package.json');
94
94
  await exec('git add .');
@@ -96,7 +96,7 @@ async function syncWithGitHub() {
96
96
  await exec('git push origin main:main');
97
97
  }
98
98
 
99
- // Operations - Upload Directory To R2
99
+ // Operations - Upload directory to Cloudflare R2.
100
100
  async function uploadDirectoryToR2(sourceDirectory, uploadDirectory) {
101
101
  async function listDirectoryEntriesRecursively(currentSourceDirectory, currentDestinationDirectory, names) {
102
102
  for (const name of names) {
@@ -125,9 +125,9 @@ async function uploadDirectoryToR2(sourceDirectory, uploadDirectory) {
125
125
  await listDirectoryEntriesRecursively(`${sourceDirectory}/${uploadDirectory}`, uploadDirectory, toplevelNames);
126
126
  }
127
127
 
128
- // Operations - Upload Module Configuration
128
+ // Operations - Upload module configuration.
129
129
  async function uploadModuleConfig() {
130
- const configJSON = await readJSONFile('src/config.json');
130
+ const configJSON = await readJSONFile('config.json');
131
131
  const stateId = configJSON.id;
132
132
  const options = {
133
133
  body: JSON.stringify(configJSON),
@@ -138,14 +138,14 @@ async function uploadModuleConfig() {
138
138
  if (!response.ok) console.log(await response.text());
139
139
  }
140
140
 
141
- // Operations - Upload Module To R2
141
+ // Operations - Upload module to Cloudflare R2.
142
142
  async function uploadModuleToR2(fromPath, toPath) {
143
143
  const packageJSON = await readJSONFile('package.json');
144
144
  const toPathWithVersion = toPath.replace(/^(.*?\.)/, `$1v${packageJSON.version}.`);
145
145
  await exec(`wrangler r2 object put ${toPathWithVersion} --file=dist/${fromPath} --content-type application/javascript --jurisdiction=eu --remote`, { stdio: 'inherit' });
146
146
  }
147
147
 
148
- // Utilities - Read JSON File
148
+ // Utilities - Read JSON file.
149
149
  async function readJSONFile(path) {
150
150
  try {
151
151
  return JSON.parse(await fs.readFile(path, 'utf8'));
package/package.json CHANGED
@@ -4,21 +4,24 @@
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "index.js",
7
- "version": "0.3.17",
7
+ "version": "0.3.20",
8
8
  "devDependencies": {
9
- "eslint": "^9.28.0",
9
+ "eslint": "^9.36.0",
10
+ "license-report": "^6.8.0",
11
+ "license-report-check": "^0.1.2",
10
12
  "nanoid": "^5.1.5",
11
- "prettier": "^3.5.3",
13
+ "npm-check-updates": "^18.3.0",
14
+ "prettier": "^3.6.2",
12
15
  "run": "^1.5.0"
13
16
  },
14
17
  "scripts": {
15
18
  "audit": "npm audit",
16
19
  "build": "echo \"***** BUILD SCRIPT NOT IMPLEMENTED. *****\"",
17
20
  "bumpVersion": "node -e \"import('./index.js').then(m => m.bumpVersion())\"",
18
- "check": "npx npm-check-updates && npm outdated",
19
- "document": "npx npm-license-crawler --onlyDirectDependencies --production --relativeLicensePath --json LICENSES.json",
21
+ "check": "npm outdated; npm-check-updates -i",
22
+ "document": "license-report --only=prod,peer > LICENSES.json && license-report-check --source ./LICENSES.json --allowed 'MIT' --allowed 'n/a' --allowed 'Apache-2.0' --output=table",
20
23
  "format": "prettier --write *.js",
21
- "lint": "npx eslint *.js",
24
+ "lint": "eslint *.js",
22
25
  "publishToNPM": "npm publish --access public",
23
26
  "release": "npm run syncWithGitHub && npm run publishToNPM",
24
27
  "syncWithGitHub": "npm run bumpVersion && node -e \"import('./index.js').then(m => m.syncWithGitHub())\"",
File without changes