@datapos/datapos-development 0.2.28 → 0.3.2

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/LICENSES.json CHANGED
@@ -1,16 +1 @@
1
- {
2
- "dotenv@16.4.5": {
3
- "licenses": "BSD-2-Clause",
4
- "repository": "https://github.com/motdotla/dotenv",
5
- "licenseFile": "node_modules/dotenv/LICENSE",
6
- "licenseUrl": "https://github.com/motdotla/dotenv/raw/master/LICENSE",
7
- "parents": "@datapos/datapos-dev-operations"
8
- },
9
- "run@1.5.0": {
10
- "licenses": "UNKNOWN",
11
- "repository": "https://github.com/DTrejo/run.js",
12
- "licenseFile": "node_modules/run/LICENSE",
13
- "licenseUrl": "https://github.com/DTrejo/run.js/raw/master/LICENSE",
14
- "parents": "@datapos/datapos-dev-operations"
15
- }
16
- }
1
+ {}
package/README.md CHANGED
@@ -1,24 +1,36 @@
1
- # DataPos - Development Operations Library
1
+ # DataPos Development Library
2
2
 
3
- A Javascript library of functions used to manage Data Positioning repositories.
3
+ A library of JavaScript utilities for managing the DataPos repositories.
4
+
5
+ ## Requirements
6
+
7
+ Ensure your environment meets the following prerequisites before using this library:
8
+
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
4
13
 
5
14
  ## Installation
6
15
 
7
16
  ```
8
- npm install --save-dev @datapos-development
17
+ npm install -D @datapos-development
9
18
  ```
10
19
 
11
- ## Production Dependencies
20
+ ## Dependencies
12
21
 
13
- The following packages are included in the production release. Please refer to 'package.json' and 'LICENSES.json' for version and license details.
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]() |
14
28
 
15
- | Name | References |
16
- | ------ | ---------------------------------------------------------------------------------------- |
17
- | dotenv | [GitHub](https://github.com/motdotla/dotenv) [NPM](https://www.npmjs.com/package/dotenv) |
29
+ Refer to package.json and LICENSES.json for detailed versions and licenses.
18
30
 
19
31
  ## Helpers
20
32
 
21
- The 'scriptHelpers.js' file exports the following helper functions.
33
+ The 'index.js' file exposes the following operations:
22
34
 
23
35
  | Name | Notes |
24
36
  | ------------------------- | ----- |
@@ -26,13 +38,15 @@ The 'scriptHelpers.js' file exports the following helper functions.
26
38
  | buildPublicDirectoryIndex | |
27
39
  | bumpVersion | |
28
40
  | clearDirectory | |
29
- | compilePresenter | |
41
+ | sendDeploymentNotice | |
30
42
  | syncWithGitHub | |
31
- | uploadPlugin | |
43
+ | uploadDirectoryToR2 | |
44
+ | uploadModuleConfig | |
45
+ | uploadModuleToR2 | |
32
46
 
33
47
  ## Repository Management Commands
34
48
 
35
- The following list details the repository management commands implementation by this project. For more details, please refer to the scripts section of the 'package.json' file in this project.
49
+ The following list details the repository management commands implemented by this project:
36
50
 
37
51
  | Name | Key Code | Notes |
38
52
  | ------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -46,22 +60,7 @@ The following list details the repository management commands implementation by
46
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. Use the command line command 'npm publish' when publishing for the first time. |
47
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. |
48
62
  | syncWithGitHub | alt+ctrl+shift+s | Synchronise the local repository with the main GitHub repository. |
49
- | test | alt+ctrl+shift+l | NOT implemented. |
50
- | updateDependencies | alt+ctrl+shift+l | NOT implemented. |
51
-
52
- ## The 'cors.json' File
53
-
54
- Set CORS Policy on Firebase Storage Bucket (No-longer publishing to Firebase Storage)
55
-
56
- See: https://firebase.google.com/docs/storage/web/download-files#cors_configuration
57
- See: https://stackoverflow.com/questions/37760695/firebase-storage-and-access-control-allow-origin/37765371
63
+ | test | alt+ctrl+shift+t | NOT implemented. |
64
+ | updateDependencies | alt+ctrl+shift+u | NOT implemented. |
58
65
 
59
- ```
60
- gsutil cors set cors.json gs://datapos-prod.appspot.com
61
- ```
62
-
63
- To list:
64
-
65
- ```
66
- gsutil cors get gs://datapos-prod.appspot.com
67
- ```
66
+ For more details, please refer to the scripts section of the 'package.json' file in this project.
@@ -10,11 +10,13 @@ const exec = util.promisify(require('child_process').exec);
10
10
  async function buildConfig() {
11
11
  const configJSON = await readJSONFile('src/config.json');
12
12
  const packageJSON = await readJSONFile('package.json');
13
- fs.writeFile('src/config.json', JSON.stringify({ ...configJSON, id: packageJSON.name, version: packageJSON.version }, undefined, 4));
13
+ await fs.writeFile('src/config.json', JSON.stringify({ ...configJSON, id: packageJSON.name, version: packageJSON.version }, undefined, 4));
14
14
  }
15
15
 
16
16
  // Operations - Build Public Directory Index
17
17
  async function buildPublicDirectoryIndex(id) {
18
+ const index = {};
19
+
18
20
  async function listDirectoryEntriesRecursively(directoryPath, names) {
19
21
  const entries = [];
20
22
  const localDirectoryPath = directoryPath.substring(`public/${id}`.length);
@@ -34,13 +36,16 @@ async function buildPublicDirectoryIndex(id) {
34
36
  console.error(`Unable to get information for '${name}' in 'buildPublicDirectoryIndex'.`, error);
35
37
  }
36
38
  }
37
- entries.sort((left, right) => right.typeId.localeCompare(left.typeId) || left.name.localeCompare(right.name));
39
+ // entries.sort((left, right) => right.typeId.localeCompare(left.typeId) || left.name.localeCompare(right.name));
40
+ entries.sort((left, right) => {
41
+ const typeComparison = left.typeId.localeCompare(right.typeId);
42
+ return typeComparison !== 0 ? typeComparison : left.name.localeCompare(right.name);
43
+ });
38
44
  }
39
45
 
40
- const index = {};
41
46
  const toplevelNames = await fs.readdir(`public/${id}`);
42
47
  await listDirectoryEntriesRecursively(`public/${id}`, toplevelNames);
43
- fs.writeFile(`./public/${id}Index.json`, JSON.stringify(index), (error) => {
48
+ await fs.writeFile(`./public/${id}Index.json`, JSON.stringify(index), (error) => {
44
49
  if (error) return console.error(error);
45
50
  });
46
51
  }
@@ -50,7 +55,7 @@ async function bumpVersion() {
50
55
  const packageJSON = await readJSONFile('package.json');
51
56
  const versionSegments = packageJSON.version.split('.');
52
57
  packageJSON.version = `${versionSegments[0]}.${versionSegments[1]}.${Number(versionSegments[2]) + 1}`;
53
- fs.writeFile('package.json', JSON.stringify(packageJSON, undefined, 4));
58
+ await fs.writeFile('package.json', JSON.stringify(packageJSON, undefined, 4));
54
59
  console.log(`Bumped to version ${packageJSON.version}.`);
55
60
  }
56
61
 
@@ -137,7 +142,7 @@ async function uploadModuleConfig() {
137
142
  async function uploadModuleToR2(fromPath, toPath) {
138
143
  const packageJSON = await readJSONFile('package.json');
139
144
  const toPathWithVersion = toPath.replace(/^(.*?\.)/, `$1v${packageJSON.version}.`);
140
- exec(`wrangler r2 object put ${toPathWithVersion} --file=dist/${fromPath} --content-type application/javascript --jurisdiction=eu --remote`, { stdio: 'inherit' });
145
+ await exec(`wrangler r2 object put ${toPathWithVersion} --file=dist/${fromPath} --content-type application/javascript --jurisdiction=eu --remote`, { stdio: 'inherit' });
141
146
  }
142
147
 
143
148
  // Utilities - Read JSON File
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "ISC",
4
4
  "private": false,
5
5
  "type": "module",
6
- "version": "0.2.28",
6
+ "version": "0.3.2",
7
7
  "devDependencies": {
8
8
  "eslint": "^9.28.0",
9
9
  "nanoid": "^5.1.5",
@@ -13,14 +13,14 @@
13
13
  "scripts": {
14
14
  "audit": "npm audit",
15
15
  "build": "echo \"***** BUILD SCRIPT NOT IMPLEMENTED. *****\"",
16
- "bumpVersion": "node -e \"import('./scriptHelpers.js').then(m => m.bumpVersion())\"",
16
+ "bumpVersion": "node -e \"import('./index.js').then(m => m.bumpVersion())\"",
17
17
  "check": "npx npm-check-updates && npm outdated",
18
18
  "document": "npx npm-license-crawler --onlyDirectDependencies --production --relativeLicensePath --json LICENSES.json",
19
19
  "format": "prettier --write *.js",
20
20
  "lint": "npx eslint *.js",
21
21
  "publishToNPM": "npm publish --access public",
22
22
  "release": "npm run syncWithGitHub && npm run publishToNPM",
23
- "syncWithGitHub": "npm run bumpVersion && node -e \"import('./scriptHelpers.js').then(m => m.syncWithGitHub())\"",
23
+ "syncWithGitHub": "npm run bumpVersion && node -e \"import('./index.js').then(m => m.syncWithGitHub())\"",
24
24
  "test": "echo \"***** TEST SCRIPT NOT IMPLEMENTED. *****\"",
25
25
  "updateDependencies": "echo \"***** UPDATE DEPENDENCIES SCRIPT NOT IMPLEMENTED. *****\""
26
26
  }
package/cors.json DELETED
@@ -1,23 +0,0 @@
1
- [
2
- {
3
- "origin": [
4
- "https://datapos.app",
5
- "https://support.datapos.app/",
6
- "https://workbench.datapos.app/",
7
- "https://www.datapos.app/",
8
- "https://datapos-prod-firebaseapp.com",
9
- "https://datapos-prod-web.app",
10
- "https://datapos-prod-support.firebaseapp.com",
11
- "https://datapos-prod-support.web.app",
12
- "https://datapos-prod-workbench.firebaseapp.com",
13
- "https://datapos-prod-workbench.web.app",
14
- "http://localhost:5173",
15
- "http://localhost:5174",
16
- "http://localhost:5175",
17
- "https://springbrook.static.observableusercontent.com",
18
- "https://workbench.datapositioning.app"
19
- ],
20
- "method": ["GET"],
21
- "maxAgeSeconds": 3600
22
- }
23
- ]