Skip to content

Commit

Permalink
docs: Setup new website using Docusaurus. (#71)
Browse files Browse the repository at this point in the history
* Create website.

* Get build running.

* Setup as a moon project.

* Enable api.

* Add config pages.

* Add concept pages.

* Copy commands.

* Update colors.

* Remove old test job.

* Add install page.

* Add workspace doc.

* Update deps.

* Start on project doc.

* Finish project page.

* Setup tailwind and font awesome.

* Use pro.

* Add labels.

* Add more features.

* Break out into components.

* Move tokens to own page.

* Flesh out global project.

* Cleanup.

* Cleanup website.

* Update arg docs.

* Start on create task.

* Add outputs.

* Use new spacing scale.

* Start fixing doc styles.

* Finish task docs.

* Move to ui.

* Add links.

* Move target to its own page.

* Add custom tailwind colors.

* Add next steps.

* Add paging link.

* Move schemas.

* Support light mode.

* Update homepage.

* Add new hero.

* Improve colors.

* Add aria.

* Fix lockfile.

* Add new logos.

* Start on footer.

* Finish footer.

* Clean up sidebar.

* Clean up.

* Fix build.

* Fix build script.

* Update logos.

* Update colors.

* Add fonts.

* Update svgs.

* Work on new homepage.

* Add responsive.

* Lowercase moon.

* Add links.

* Update docusaurus.

* Drop node 12.

* Add CI guide.

* Cleanup.

* Add version file.

* Add run docs.

* Update fixtures to use git.

* Fix build.

* Log git.

* Add author.

* Add terms.

* Fix tests.

* More logging.

* Set committer also.

* Add helpers.

* More updates.

* Update version.

* And again.

* Add open source.
  • Loading branch information
milesj authored May 15, 2022
1 parent 233935d commit b327490
Show file tree
Hide file tree
Showing 142 changed files with 14,614 additions and 3,536 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules/
.docusaurus/
build/
cjs/
coverage/
Expand All @@ -7,6 +7,7 @@ dts/
esm/
lib/
mjs/
node_modules/
umd/
*.min.js
*.map
Expand Down
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ module.exports = {
tsconfigRootDir: __dirname,
},
overrides: [
{
files: ['**/*.config.js'],
rules: {
'import/no-commonjs': 'off',
},
},
{
files: ['scripts/**/*'],
rules: {
Expand All @@ -14,5 +20,12 @@ module.exports = {
'promise/prefer-await-to-callbacks': 'off',
},
},
{
files: ['website/**/*'],
rules: {
// Path aliases
'import/no-unresolved': 'off',
},
},
],
};
6 changes: 4 additions & 2 deletions .github/workflows/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: ['14.19.0', '16.14.0', '18.0.0']
node-version: [14, 16, 18]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -45,10 +45,12 @@ jobs:
with:
toolchain: 1.60.0
profile: minimal
- uses: moonrepo/tool-version-action@v1
with:
node: ${{ matrix.node-version }}
- uses: actions-rs/cargo@v1
with:
command: run
args: -- --logLevel trace ci
env:
CLICOLOR_FORCE: true
MOON_NODE_VERSION: ${{ matrix.node-version }}
18 changes: 5 additions & 13 deletions .moon/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,14 @@ fileGroups:
tasks:
build:
command: 'packemon'
args:
- 'build'
- '--addEngines'
- '--addExports'
args: 'build'
inputs:
- '@globs(sources)'
- 'package.json'
- 'tsconfig.json'
- '/tsconfig.options.json'
outputs:
- 'dts'
- 'mjs'
env:
NODE_ENV: production

format:
command: 'prettier'
Expand All @@ -51,21 +45,20 @@ tasks:
- '.eslintcache'
- '--color'
- '--ext'
- '.ts,.tsx'
- '.js,.ts,.tsx'
- '--fix'
- '--ignore-path'
- '@in(4)'
- '@in(5)'
- '--exit-on-fatal-error'
- '--no-error-on-unmatched-pattern'
- '--report-unused-disable-directives'
- '.'
deps:
- 'runtime:typecheck'
inputs:
- '@globs(sources)'
- '@globs(tests)'
- 'package.json'
- 'tsconfig.json'
- '*.js'
- '/.eslintignore'
- '/.eslintrc.js'
- '/package.json'
Expand All @@ -79,13 +72,12 @@ tasks:
- '--preset'
- 'jest-preset-beemo'
- '--passWithNoTests'
- '.'
inputs:
- '@globs(sources)'
- '@globs(tests)'
- 'package.json'
- 'jest.config.js'
outputs:
- 'dts'

typecheck:
command: 'tsc'
Expand Down
1 change: 1 addition & 0 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ node:

projects:
runtime: 'packages/runtime'
website: 'website'
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
coverage/

# Build folders
.docusaurus/
coverage/
build/
cjs/
dts/
esm/
lib/
mjs/
node_modules/
umd/

# Node.js formats differently
Expand Down
7 changes: 7 additions & 0 deletions .yarn/versions/5ecc0c78.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declined:
- "@moonrepo/cli"
- "@moonrepo/core-linux-x64-gnu"
- "@moonrepo/core-linux-x64-musl"
- "@moonrepo/core-macos-x64"
- "@moonrepo/core-windows-x64-msvc"
- "@moonrepo/runtime"
6 changes: 6 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ changesetIgnorePatterns:
- '**/mjs/**/*'
- '**/*.test.{js,ts,tsx}'
- '**/*.{md,mdx}'
- 'website/**/*'

enableGlobalCache: true

enableTelemetry: false

nodeLinker: node-modules

npmScopes:
fortawesome:
npmRegistryServer: https://npm.fontawesome.com
npmAuthToken: 23F99634-A6B0-4362-BB2B-7163253D741D

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Moon
# moon

> Currently a work in progress!
Moon is a *m*onorepo *o*rganization, *o*rchestration, and *n*otification tool for JavaScript based
projects, written in Rust. Many of the concepts within Moon are heavily inspired from Bazel.
moon is a repository *m*anagement, *o*rganization, *o*rchestration, and *n*otification tool for
JavaScript based projects, written in Rust. Many of the concepts within moon are heavily inspired
from Bazel and other popular build systems, but tailored for the JavaScript ecosystem.

- [Documentation](./docs/README.md)

Expand Down
4 changes: 4 additions & 0 deletions docs/roadmap.md → ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,7 @@
- [ ] `run-many`
- [ ] `graph`
- [ ] Spin up an interactive website with full project/task data

# 0.3.0

- new website
18 changes: 12 additions & 6 deletions crates/cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,19 @@ pub enum Commands {
#[clap(help = "Target (project:task) to run")]
target: TargetID,

// Affected
#[clap(
long,
help = "Only run target if affected by changed files",
help_heading = HEADING_AFFECTED
help = "Run dependents of the same task, as well as dependencies"
)]
affected: bool,
dependents: bool,

// Affected
#[clap(
long,
help = "Determine affected from local changes instead of comparing against a base",
help = "Only run target if affected by changed files",
help_heading = HEADING_AFFECTED
)]
local: bool,
affected: bool,

#[clap(
arg_enum,
Expand All @@ -133,6 +132,13 @@ pub enum Commands {
)]
status: RunStatus,

#[clap(
long,
help = "Determine affected against upstream by comparing against a base revision",
help_heading = HEADING_AFFECTED
)]
upstream: bool,

// Passthrough args (after --)
#[clap(
last = true,
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn gather_runnable_targets(
} else {
debug!(
target: TARGET,
"Not running target {} because it either has no `outputs` or `runInCi` is false",
"Not running target {} because it either has no `outputs` or `runInCI` is false",
color::target(&target.id),
);
}
Expand Down
18 changes: 12 additions & 6 deletions crates/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,24 @@ impl Default for RunStatus {

pub struct RunOptions {
pub affected: bool,
pub local: bool,
pub dependents: bool,
pub status: RunStatus,
pub passthrough: Vec<String>,
pub upstream: bool,
}

async fn get_touched_files(
workspace: &Workspace,
status: &RunStatus,
local: bool,
upstream: bool,
) -> Result<TouchedFilePaths, WorkspaceError> {
let vcs = workspace.detect_vcs();

let touched_files = if local {
vcs.get_touched_files().await?
} else {
let touched_files = if upstream {
vcs.get_touched_files_between_revisions(vcs.get_default_branch(), "HEAD")
.await?
} else {
vcs.get_touched_files().await?
};

let files = match status {
Expand Down Expand Up @@ -161,7 +162,8 @@ pub async fn run(target_id: &str, options: RunOptions) -> Result<(), Box<dyn std
let mut dep_graph = DepGraph::default();

if options.affected {
let touched_files = get_touched_files(&workspace, &options.status, options.local).await?;
let touched_files =
get_touched_files(&workspace, &options.status, options.upstream).await?;
let inserted_count =
dep_graph.run_target(&target, &workspace.projects, Some(&touched_files))?;

Expand All @@ -182,6 +184,10 @@ pub async fn run(target_id: &str, options: RunOptions) -> Result<(), Box<dyn std
dep_graph.run_target(&target, &workspace.projects, None)?;
}

if options.dependents {
dep_graph.run_target_dependents(&target, &workspace.projects)?;
}

// Process all tasks in the graph
let mut runner = ActionRunner::new(workspace);

Expand Down
6 changes: 4 additions & 2 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,19 @@ pub async fn run_cli() {
Commands::Run {
target,
affected,
local,
dependents,
status,
passthrough,
upstream,
} => {
run(
target,
RunOptions {
affected: *affected,
local: *local,
dependents: *dependents,
status: status.clone(),
passthrough: passthrough.clone(),
upstream: *upstream,
},
)
.await
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/run_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mod caching {
assert_eq!(state.item.target, "node:standard");
assert_eq!(
state.item.hash,
"0957f07cd32663feeac762e10189d4be02c100309ed3e28c9d7491f1e040960d"
"3270284f4824b530c3006108757e715f73a43f949c811db7c0859aded12d9036"
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/config/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ fn main() {
let workspace_schema = schema_for!(WorkspaceConfig);

fs::write(
"schemas/project.json",
"website/static/schemas/project.json",
serde_json::to_string_pretty(&project_schema).unwrap(),
)
.unwrap();

fs::write(
"schemas/global-project.json",
"website/static/schemas/global-project.json",
serde_json::to_string_pretty(&global_project_schema).unwrap(),
)
.unwrap();

fs::write(
"schemas/workspace.json",
"website/static/schemas/workspace.json",
serde_json::to_string_pretty(&workspace_schema).unwrap(),
)
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions crates/config/src/project/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn validate_tasks(map: &HashMap<String, TaskConfig>) -> Result<(), ValidationErr
return Err(create_validation_error(
"required_command",
&format!("tasks.{}.command", name),
String::from("An npm/shell command is required."),
String::from("An npm/system command is required."),
));
}
}
Expand Down Expand Up @@ -244,7 +244,7 @@ tasks:

#[test]
#[should_panic(
expected = "Invalid field `tasks.test.command`. An npm/shell command is required."
expected = "Invalid field `tasks.test.command`. An npm/system command is required."
)]
fn invalid_value_empty_field() {
figment::Jail::expect_with(|jail| {
Expand Down
4 changes: 2 additions & 2 deletions crates/config/src/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn validate_tasks(map: &HashMap<String, TaskConfig>) -> Result<(), ValidationErr
return Err(create_validation_error(
"required_command",
&format!("tasks.{}.command", name),
String::from("An npm/shell command is required."),
String::from("An npm/system command is required."),
));
}
}
Expand Down Expand Up @@ -363,7 +363,7 @@ tasks:

#[test]
#[should_panic(
expected = "Invalid field `tasks.test.command`. An npm/shell command is required."
expected = "Invalid field `tasks.test.command`. An npm/system command is required."
)]
fn invalid_value_empty_field() {
figment::Jail::expect_with(|jail| {
Expand Down
1 change: 1 addition & 0 deletions crates/config/src/project/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub struct TaskOptionsConfig {

pub retry_count: Option<u8>,

#[serde(rename = "runInCI")]
pub run_in_ci: Option<bool>,

pub run_from_workspace_root: Option<bool>,
Expand Down
Loading

0 comments on commit b327490

Please sign in to comment.