Skip to content

Commit

Permalink
revert a few commits
Browse files Browse the repository at this point in the history
1. We don’t want to use third-party UUID implementation; browsers ship
   their own and Node surely is going to. The CLI package is provisional
   and doesn’t need to work for now.
2. I believe there have been some changes that break convertors,
   such as removing the `fullPath` parameter from File objects.
   This parameter is used by, e.g., the glossarist-ruby convertor.

This reverts commit b5053f6.
  • Loading branch information
strogonoff committed Dec 18, 2023
1 parent f81a8e7 commit 5735aa6
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 72 deletions.
57 changes: 39 additions & 18 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,67 @@ on:
repository_dispatch:
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
environment:
name: production
steps:
- uses: actions/checkout@v4

- name: Use Node
uses: actions/setup-node@v4
uses: actions/setup-node@v2
with:
node-version: 18
cache: 'yarn'
node-version: '18.x'

- uses: actions/checkout@master

- name: Enable Yarn Berry
run: |
corepack enable
corepack prepare yarn@stable --activate
# - name: Compile all packages
# # TODO: Get rid of, the esbuild step should be sufficient.
# # However, currently some packages rely on `compiled/` paths,
# # which are created by running `compile` commands.
# run: |
# yarn compile-all

- name: Setup Pages
id: pages
uses: actions/configure-pages@v3

- name: Compile all packages
# TODO: Get rid of, the esbuild step should be sufficient.
# However, currently some packages rely on `compiled/` paths,
# which are created by running `compile` commands.
- name: Build site
run: |
yarn compile-all
yarn workspace webgui build --debug
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
name: webgui-dist
path: packages/webgui/dist/

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: build
steps:

- name: Trigger deployment of convert.glossarist.org
uses: benc-uk/workflow-dispatch@v1
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
with:
workflow: build_deploy.yml
repo: glossarist/convert.glossarist.org
token: ${{ secrets.GLOSSARIST_CI_PAT_TOKEN }}
ref: main
# inputs: '{ "message": "blah blah", "something": false }'
artifact_name: webgui-dist
55 changes: 55 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: links

on:
push:
branches:
- master
- staging
pull_request:

jobs:
link_checker:
runs-on: ubuntu-latest
environment:
name: production
steps:
- name: Use Node
uses: actions/setup-node@v2
with:
node-version: '18.x'

- uses: actions/checkout@master

- name: Enable Yarn Berry
run: |
corepack enable
corepack prepare yarn@stable --activate
# - name: Compile all packages
# # TODO: Get rid of, the esbuild step should be sufficient.
# # However, currently some packages rely on `compiled/` paths,
# # which are created by running `compile` commands.
# run: |
# yarn compile-all

- name: Setup Pages
id: pages
uses: actions/configure-pages@v3

- name: Build site
run: |
yarn workspace webgui build --debug
- name: Link Checker
uses: lycheeverse/[email protected]
with:
args: --verbose --no-progress --exclude-file .lycheeignore -- _site/**/*.html
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

# - name: Create Issue From File
# uses: peter-evans/create-issue-from-file@v2
# with:
# title: Link Checker Report
# content-filepath: ./lychee/out.md
# labels: report, automated issue
21 changes: 0 additions & 21 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
6 changes: 2 additions & 4 deletions packages/cli/src/fs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import type { File, } from 'common';
import type { File } from 'common';


/**
Expand All @@ -10,8 +9,7 @@ export async function * fsPathToFiles(absPath: string) {
for (const filepath of await fs.readdir(absPath)) {
const file: File = {
blob: Uint8Array.from(await fs.readFile(filepath)),
name: path.basename(filepath),
fullPath: filepath,
name: filepath,
};
yield file;
}
Expand Down
3 changes: 0 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"compile": "tsc --outdir compiled",
"clean": "rm -r compiled"
},
"dependencies": {
"@lukeed/uuid": "^2"
},
"devDependencies": {
"@riboseinc/paneron-extension-glossarist": "^2.0.11",
"@riboseinc/paneron-registry-kit": "2.2.2",
Expand Down
3 changes: 1 addition & 2 deletions packages/common/src/convertors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type {
CommonStreamProcessingOptions,
RegisterItemsByClassID,
} from './base.js';
import { v4 as generateUUID } from '@lukeed/uuid/secure';

export type { Convertor, FileConvertor, File } from './base.js';

Expand All @@ -24,7 +23,7 @@ export async function asProposal<R extends RegisterConfiguration>(
itemPayloads: Record<string, RegisterItem<any>>,
}> {
const now = new Date();
const id = generateUUID();
const id = crypto.randomUUID();
const proposalDraft: ProposalDraft = {
...proposalOptions,
id,
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/glossary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { RegisterItem, RegisterConfiguration, ItemClassConfiguration } from
import type { ConceptData } from '@riboseinc/paneron-extension-glossarist/classes/concept.js';
import type { LocalizedConceptData } from '@riboseinc/paneron-extension-glossarist/classes/localizedConcept/LocalizedConceptData.js';
import type { Designation } from '@riboseinc/paneron-extension-glossarist/models/concepts.js';
import { v4 as generateUUID } from '@lukeed/uuid/secure';

import { teeAsync } from './util.js';

import type {
Expand Down Expand Up @@ -43,8 +43,8 @@ export async function * asRegisterItemsWithInferredUniversal(
const designation = conceptData.terms[0]!.designation;
const identifier = /* opts?.conceptIDMaker?.(idx, conceptData) ?? */ `${idx + 1}`;
opts?.onProgress?.(`Outputting as register items: #${idx + 1} (${designation}) (using ID “${identifier}”)`);
const universalUUID = generateUUID();
const localizedUUID = generateUUID();
const universalUUID = crypto.randomUUID();
const localizedUUID = crypto.randomUUID();
const universalConcept: RegisterItem<ConceptData> = {
id: universalUUID,
data: {
Expand Down
1 change: 0 additions & 1 deletion packages/gr-sheet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"read-excel-file": "^5.6.1"
},
"devDependencies": {
"@lukeed/uuid": "^2",
"@riboseinc/paneron-extension-geodetic-registry": "^1.0.19",
"@riboseinc/paneron-registry-kit": "2.2.2",
"common": "workspace:^",
Expand Down
3 changes: 1 addition & 2 deletions packages/gr-sheet/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import type { UoMData } from '@riboseinc/paneron-extension-geodetic-registry/cla
import type { NonCompoundCRSData } from '@riboseinc/paneron-extension-geodetic-registry/classes/crs.js';

import xlsx, { readSheetNames, type Row } from 'read-excel-file';
import { v4 as generateUUID } from '@lukeed/uuid/secure';

import type { FileConvertor } from '../../common/src/convertors/index.js';
import { teeAsync } from '../../common/src/util.js';
Expand Down Expand Up @@ -211,7 +210,7 @@ async function * generateGRItems(parsedSheetItems, opts) {
const classID = processor.getClassID(
rowParsed as Record<Exclude<(typeof processor)["fields"][number], null>, string>
);
const itemID = generateUUID();
const itemID = crypto.randomUUID();
const itemRef = { classID, itemID };
const identifier = availableID;
availableID = availableID - 1;
Expand Down
18 changes: 0 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -334,22 +334,6 @@ __metadata:
languageName: node
linkType: hard

"@lukeed/csprng@npm:^1.1.0":
version: 1.1.0
resolution: "@lukeed/csprng@npm:1.1.0"
checksum: 926f5f7fc629470ca9a8af355bfcd0271d34535f7be3890f69902432bddc3262029bb5dbe9025542cf6c9883d878692eef2815fc2f3ba5b92e9da1f9eba2e51b
languageName: node
linkType: hard

"@lukeed/uuid@npm:^2":
version: 2.0.1
resolution: "@lukeed/uuid@npm:2.0.1"
dependencies:
"@lukeed/csprng": ^1.1.0
checksum: f5e71e4da852dbff49b93cad27d5a2f61c2241e307bbe89b3b54b889ecb7927f2487246467f90ebb6cbdb7e0ac2a213e2e58b1182cb7990cef6e049aa7c39e7b
languageName: node
linkType: hard

"@npmcli/fs@npm:^3.1.0":
version: 3.1.0
resolution: "@npmcli/fs@npm:3.1.0"
Expand Down Expand Up @@ -435,7 +419,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@riboseinc/parse-gr-sheet@workspace:packages/gr-sheet"
dependencies:
"@lukeed/uuid": ^2
"@riboseinc/paneron-extension-geodetic-registry": ^1.0.19
"@riboseinc/paneron-registry-kit": 2.2.2
common: "workspace:^"
Expand Down Expand Up @@ -818,7 +801,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "common@workspace:packages/common"
dependencies:
"@lukeed/uuid": ^2
"@riboseinc/paneron-extension-glossarist": ^2.0.11
"@riboseinc/paneron-registry-kit": 2.2.2
"@types/node": ^18
Expand Down

0 comments on commit 5735aa6

Please sign in to comment.