Skip to content

Commit

Permalink
update docs, cleanup repo, improve security
Browse files Browse the repository at this point in the history
  • Loading branch information
xuelongmu committed Feb 2, 2024
1 parent 3fe7e82 commit 69ab055
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 41 deletions.
133 changes: 132 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,133 @@
# Ignore launch.json to avoid committing sensitive environment variables
launch.json

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
tags
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
23 changes: 0 additions & 23 deletions .vscode/launch.json

This file was deleted.

47 changes: 36 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ All configuration are done with environment variables for compatibility with oth

### Unity Version Control

To use it in Unity DevOps, you will need to create a new build configuration for the Plastic (aka Unity VCS) repository. In the Advanced settings, set the environment variables described in the yaml below. `RELATIVE_URLS_ROOT` can be left blank. DEBUG = 1 will show additional console logs. Create a new shell script e.g. `readmeToNotion.sh` and paste the following:
To use it in Unity DevOps, you will need to create a new build configuration for the Plastic (aka Unity VCS) repository. In the Advanced settings, set the environment variables described in the yaml below. `RELATIVE_URLS_ROOT` can be left blank. DEBUG = 1 will show additional console logs. Create a new shell script `readme_to_notion.sh` in your repository root directory and paste the following:

```bash
#!/usr/bin/env bash
Expand All @@ -34,7 +34,7 @@ git clone https://github.com/ZeroSpace-Studios/sync-repo-docs-to-notion.git
node sync-repo-docs-to-notion/dist/index.js
```

Set either your pre-build script or post-build script to the `readmeToNotion.sh`. In the basic settings, also set Auto-build so that the README gets automatically updated in Notion whenever you've updated the project. (Currently this feature is not working as expected as Unity DevOps have decided to automatically cancel auto-build if your project fails to build).
Set either your pre-build script or post-build script to the `readme_to_notion.sh`. In the basic settings, also set Auto-build so that the README gets automatically updated in Notion whenever you've updated the project. (Currently this feature is not working as expected as Unity DevOps have decided to automatically cancel auto-build if your project fails to build).

See the `ZS_1123_VolumetricRnD` configuration as an example.

Expand Down Expand Up @@ -104,20 +104,45 @@ jobs:
### Warnings
- Deletion is slow, if you changed a lot of documents it's easier to cleanup Notion first, and then run the action
## Local installation
## Local installation and developer setup
- install [nvm for windows](https://github.com/coreybutler/nvm-windows)
- nvm install 16.20.0
- nvm use 16.20.0
- clone this project
- navigate to cloned project
- npm install
- set environment variables:
```bash
$env:FOLDER=$pwd # your project root directory (where the README is located)
$env:NOTION_TOKEN='your_notion_token'
$env:NOTION_ROOT_PAGE_ID='your_page_id'
$env:RELATIVE_URLS_ROOT='null'
### VS Code
- Configure your launch.json with environment variables (Be sure not to commit them to the repo!):
```json
"program": "${workspaceFolder}\\index.js",
"env": {
"FOLDER": "${workspaceFolder}",
"NOTION_TOKEN": "NOTION_SECRET_HERE_DO_NOT_COMMIT",
"NOTION_ROOT_PAGE_ID": "NOTION_PAGE_ID_HERE_DO_NOT_COMMIT",
"RELATIVE_URLS_ROOT": "null",
"DEBUG": 1
}
```
- node index.js

### Local shell
- To set environment variables in Windows powershell:
```powershell
$env:FOLDER=$pwd
$env:NOTION_TOKEN='NOTION_SECRET'
$env:NOTION_ROOT_PAGE_ID='NOTION_PAGE_ID'
$env:RELATIVE_URLS_ROOT='null'
```

- Or, in bash environment:
```bash
$env:FOLDER=$pwd # your project root directory (where the README is located)
$env:NOTION_TOKEN='your_notion_token'
$env:NOTION_ROOT_PAGE_ID='your_page_id'
$env:RELATIVE_URLS_ROOT='null'
```
- Then run `node index.js`

### Deployment
- To compile into `dist/index.js` for deployment, run `ncc build index.js`. This packages up the node modules so that `npm install` does not have to be run on deployed instances. Be sure to commit the updated `dist/index.js` as well.

6 changes: 0 additions & 6 deletions docsToNotion.ps1

This file was deleted.

0 comments on commit 69ab055

Please sign in to comment.